Documentation ¶
Index ¶
- Variables
- func DefaultCORS(c *fiber.Ctx) error
- func NewAuthInterceptor(excludePaths []string, itp func(c *fiber.Ctx) error) func(c *fiber.Ctx) error
- type FiberContext
- func (c *FiberContext) BindQuery(obj any) error
- func (c *FiberContext) BindQueryNotImplemented() bool
- func (c *FiberContext) BodyParser(obj any) error
- func (c *FiberContext) ClientIP() string
- func (c *FiberContext) ContentType() string
- func (c *FiberContext) Cookie(name string) (string, error)
- func (c *FiberContext) Ctx() any
- func (c *FiberContext) File(filepath string) error
- func (c *FiberContext) FileAttachment(filepath, filename string) error
- func (c *FiberContext) Get(key string, defaultValue ...string) string
- func (c *FiberContext) Header(key, value string)
- func (c *FiberContext) JSON(statusCode int, data any) error
- func (c *FiberContext) JSONP(code int, data any) error
- func (c *FiberContext) Method() string
- func (c *FiberContext) Params(key string, undefined ...string) string
- func (c *FiberContext) Path() string
- func (c *FiberContext) Query(key string, undefined ...string) string
- func (c *FiberContext) Redirect(code int, location string) error
- func (c *FiberContext) Render(name string, bind interface{}, layouts ...string) error
- func (c *FiberContext) SendStream(stream io.Reader, size ...int) error
- func (c *FiberContext) SendString(s string) error
- func (c *FiberContext) Set(key string, value any)
- func (c *FiberContext) SetCookie(cookie *http.Cookie)
- func (c *FiberContext) ShouldBind(obj any) error
- func (c *FiberContext) ShouldBindNotImplemented() bool
- func (c *FiberContext) Status(statusCode int)
- func (c *FiberContext) TOML(code int, obj any) error
- func (c *FiberContext) Validate(obj any) error
- func (c *FiberContext) Write(p []byte) (int, error)
- func (c *FiberContext) XML(code int, content any) error
- func (c *FiberContext) YAML(code int, obj any) error
- type FiberMux
- func (m *FiberMux) AcquireCtx(c *fiber.Ctx) *FiberContext
- func (m *FiberMux) App() *fiber.App
- func (m *FiberMux) BindRoute(method, path string, handler fastapi.MuxHandler) error
- func (m *FiberMux) Listen(addr string) error
- func (m *FiberMux) ReleaseCtx(c *FiberContext)
- func (m *FiberMux) ShutdownWithTimeout(timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
View Source
var FastApiExcludePaths = []string{ openapi.DocumentUrl, openapi.ReDocumentUrl, "/" + openapi.SwaggerCssName, "/" + openapi.FaviconName, "/" + openapi.FaviconIcoName, "/" + openapi.SwaggerJsName, "/" + openapi.RedocJsName, "/" + openapi.JsonUrl, }
Functions ¶
func DefaultCORS ¶
func DefaultCORS(c *fiber.Ctx) error
func NewAuthInterceptor ¶ added in v0.2.7
func NewAuthInterceptor(excludePaths []string, itp func(c *fiber.Ctx) error) func(c *fiber.Ctx) error
NewAuthInterceptor 请求认证拦截器,验证请求是否需要认证,如果需要认证,则执行拦截器,否则继续执行
@param excludePaths []string 排除的路径,如果请求路径匹配这些路径,则不执行拦截器 @param itp func(c *fiber.Ctx) error 拦截器函数 @return fiber.Handler
Types ¶
type FiberContext ¶
type FiberContext struct {
// contains filtered or unexported fields
}
func (*FiberContext) BindQuery ¶
func (c *FiberContext) BindQuery(obj any) error
func (*FiberContext) BindQueryNotImplemented ¶
func (c *FiberContext) BindQueryNotImplemented() bool
func (*FiberContext) BodyParser ¶
func (c *FiberContext) BodyParser(obj any) error
func (*FiberContext) ClientIP ¶
func (c *FiberContext) ClientIP() string
func (*FiberContext) ContentType ¶
func (c *FiberContext) ContentType() string
func (*FiberContext) Ctx ¶ added in v0.2.8
func (c *FiberContext) Ctx() any
func (*FiberContext) File ¶
func (c *FiberContext) File(filepath string) error
func (*FiberContext) FileAttachment ¶
func (c *FiberContext) FileAttachment(filepath, filename string) error
func (*FiberContext) Header ¶
func (c *FiberContext) Header(key, value string)
func (*FiberContext) Method ¶
func (c *FiberContext) Method() string
func (*FiberContext) Path ¶
func (c *FiberContext) Path() string
func (*FiberContext) Render ¶
func (c *FiberContext) Render(name string, bind interface{}, layouts ...string) error
func (*FiberContext) SendStream ¶
func (c *FiberContext) SendStream(stream io.Reader, size ...int) error
func (*FiberContext) SendString ¶
func (c *FiberContext) SendString(s string) error
func (*FiberContext) Set ¶
func (c *FiberContext) Set(key string, value any)
func (*FiberContext) SetCookie ¶
func (c *FiberContext) SetCookie(cookie *http.Cookie)
func (*FiberContext) ShouldBind ¶
func (c *FiberContext) ShouldBind(obj any) error
func (*FiberContext) ShouldBindNotImplemented ¶
func (c *FiberContext) ShouldBindNotImplemented() bool
func (*FiberContext) Status ¶
func (c *FiberContext) Status(statusCode int)
func (*FiberContext) Validate ¶
func (c *FiberContext) Validate(obj any) error
type FiberMux ¶
type FiberMux struct {
// contains filtered or unexported fields
}
func (*FiberMux) AcquireCtx ¶
func (m *FiberMux) AcquireCtx(c *fiber.Ctx) *FiberContext
func (*FiberMux) BindRoute ¶
func (m *FiberMux) BindRoute(method, path string, handler fastapi.MuxHandler) error
func (*FiberMux) ReleaseCtx ¶
func (m *FiberMux) ReleaseCtx(c *FiberContext)
Click to show internal directories.
Click to hide internal directories.