Documentation ¶
Index ¶
- Variables
- func Cors(c *gin.Context, config *CorsConfig)
- func DefaultCors(c *gin.Context)
- func NoMethod(c *gin.Context)
- func NoRoute(c *gin.Context)
- type App
- func (a *App) InitRouter(fn ...func(c *gin.RouterGroup))
- func (a *App) LastUse(midd ...gin.HandlerFunc)
- func (a *App) NoMethodUse(midd ...gin.HandlerFunc)
- func (a *App) NoRouteUse(midd ...gin.HandlerFunc)
- func (a *App) PreUse(midd ...gin.HandlerFunc)
- func (a *App) Run(addr string) (err error)
- func (a *App) Use(midd ...gin.HandlerFunc)
- type CorsConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultAllowHeaders = []string{"authorization", "token", "content-type", "x-requested-with"} DefaultAllowMethods = []string{http.MethodPost, http.MethodGet, http.MethodPut, http.MethodDelete, http.MethodOptions, http.MethodPatch} )
Functions ¶
func DefaultCors ¶ added in v1.0.25
Types ¶
type App ¶ added in v1.0.25
type App struct { *gin.Engine NoMethodHandleFunc []gin.HandlerFunc NoRouteHandleFunc []gin.HandlerFunc PreHandleFunc []gin.HandlerFunc MiddleHandleFunc []gin.HandlerFunc LastHandleFunc []gin.HandlerFunc Router []func(c *gin.RouterGroup) }
func (*App) InitRouter ¶ added in v1.0.26
func (a *App) InitRouter(fn ...func(c *gin.RouterGroup))
InitRouter 保证全局中间价注册完成之后才会初始化路由 路由也是中间件的形式实现,use注册的顺序保证执行的顺序
func (*App) LastUse ¶ added in v1.0.25
func (a *App) LastUse(midd ...gin.HandlerFunc)
func (*App) NoMethodUse ¶ added in v1.0.25
func (a *App) NoMethodUse(midd ...gin.HandlerFunc)
func (*App) NoRouteUse ¶ added in v1.0.25
func (a *App) NoRouteUse(midd ...gin.HandlerFunc)
func (*App) PreUse ¶ added in v1.0.25
func (a *App) PreUse(midd ...gin.HandlerFunc)
func (*App) Use ¶ added in v1.0.25
func (a *App) Use(midd ...gin.HandlerFunc)
type CorsConfig ¶ added in v1.0.25
type CorsConfig struct { AllowOrigins []string AllowMethods []string AllowHeaders []string AllowCredentials bool }
func DefaultCorsConfig ¶ added in v1.0.25
func DefaultCorsConfig() *CorsConfig
Click to show internal directories.
Click to hide internal directories.