-
Notifications
You must be signed in to change notification settings - Fork 43
自定义中间件
YoyoFx edited this page Dec 8, 2020
·
2 revisions
type CustomMiddleware struct {
}
func NewCustomMiddleware() *CustomMiddleware {
return &CustomMiddleware { }
}
func (middleware*CustomMiddleware ) Inovke(ctx *context.HttpContext, next func(ctx *context.HttpContext)) {
// ....
next(ctx)
}
func main() {
app.CreateDefaultBuilder(registerEndpointRouterConfig).
Configure(func(app *app.WebApplicationBuilder) {
app.UseMiddleware(NewCustomMiddleware())
}).Build().Run()
}