Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultQueryPage = 1 DefaultQuerySize = 20 MaxQuerySize = 100 )
Variables ¶
View Source
var DefaultErrorHandler = func(c *fiber.Ctx, err error) error {
code := fiber.StatusInternalServerError
if e, ok := err.(*fiber.Error); ok {
code = e.Code
}
c.Set(fiber.HeaderContentType, fiber.MIMEApplicationJSON)
return c.Status(code).JSON(fiber.Map{"error": err.Error()})
}
DefaultErrorHandler that process return errors from handlers
View Source
var DefaultFiberConfig = fiber.Config{ Prefork: util.GetEnv("HTTP_PRE_FORK", "false") == "true", ServerHeader: util.GetEnv("HTTP_SERVER_HEADER", "GoFiber"), ProxyHeader: util.GetEnv("HTTP_PROXY_HEADER", httputil.HeaderXForwardedFor), ReduceMemoryUsage: util.GetEnv("HTTP_REDUCE_MEMORY_USAGE", "true") == "true", DisableStartupMessage: util.GetEnv("HTTP_DISABLE_STARTUP_MESSAGE", "true") == "true", }
DefaultFiberConfig that use for standard fiber configuration
View Source
var DefaultServerAccessLog = func(lvl logrus.Level) fiber.Handler { logOut := logrus.New() logOut.SetLevel(lvl) return logger.New(logger.Config{ Format: "${time} ${method} ${path} - ${ip} - ${status} - ${latency}\n", TimeZone: "Asia/Bangkok", TimeFormat: time.ANSIC, Output: logOut.WriterLevel(lvl), }) }
DefaultServerAccessLog that use for enable fiber log to specific router
Functions ¶
func ApplyStaticRoute ¶
func ApplyStaticRoute(s *fiber.App, publicDir string)
ApplyStaticRoute that use for serve angular built
Types ¶
type Pagination ¶
func GetPagination ¶
func GetPagination(ctx *fiber.Ctx) Pagination
func (*Pagination) Offset ¶
func (p *Pagination) Offset() int
type SkipperPath ¶
func NewSkipperPath ¶
func NewSkipperPath(prefix string) SkipperPath
func (*SkipperPath) Add ¶
func (s *SkipperPath) Add(path string, method string)
func (*SkipperPath) Delete ¶
func (s *SkipperPath) Delete(path string, method string)
func (*SkipperPath) Test ¶
func (s *SkipperPath) Test(ctx *fiber.Ctx) bool
Click to show internal directories.
Click to hide internal directories.