如果我使用多个中间件,并且我想使用 in using 的输出,是否有任何定义的中间件执行顺序?mw1mw2ctx.Setctx.Get
func main() {
// Creates a router without any middleware by default
r := gin.New()
// Global middleware
// Logger middleware will write the logs to gin.DefaultWriter even you set with GIN_MODE=release.
// By default gin.DefaultWriter = os.Stdout
r.Use(mw1)
// Recovery middleware recovers from any panics and writes a 500 if there was one.
r.Use(mw2)
// Per route middleware, you can add as many as you desire.
r.GET("/benchmark", MyBenchLogger(), benchEndpoint)
}
例如在上面的狙击是被称为第一,还是?他们的订购是否有保证?mw1mw2
慕村9548890
相关分类