Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultQueryPage = 1 DefaultQuerySize = 20 MaxQuerySize = 100 )
Variables ¶
View Source
var DefaultErrorHandler = func(ctx *fiber.Ctx, err error) error { code := fiber.StatusInternalServerError var e *fiber.Error if errors.As(err, &e) { code = e.Code } if code >= fiber.StatusInternalServerError { logrus.Error("[PANIC] "+fmt.Sprintf(" [%s] ", ctx.IP())+ctx.Route().Method+ctx.Route().Path+" -> ", err) } ctx.Set(fiber.HeaderContentType, fiber.MIMEApplicationJSON) return ctx.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", ErrorHandler: DefaultErrorHandler, }
DefaultFiberConfig that use for standard fiber configuration
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 Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) EnableHealthCheck ¶ added in v2.0.9
func (s *Server) EnableHealthCheck()
func (*Server) EnableRequestId ¶ added in v2.0.9
func (s *Server) EnableRequestId()
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.