Now, you can use the below code to add a middleware to a group. All the handlers could be add to group.
o := tango.Classic()
o.Group("/api", func(g *Group) {
g.Use(HandlerFunc(func (ctx *Context) {
fmt.Println("this is a group middleware")
ctx.Next()
}))
g.Get("/1", func() string {
return "/1"
})
})
Author: @lunny
Now, you can use the below code to add a middleware to a group. All the handlers could be add to group.
```
o := tango.Classic()
o.Group("/api", func(g *Group) {
g.Use(HandlerFunc(func (ctx *Context) {
fmt.Println("this is a group middleware")
ctx.Next()
}))
g.Get("/1", func() string {
return "/1"
})
})
```
Author: @Shuenhoy
Author: @lunny
其实只要在中间件中匹配Group的前缀就可以了。
Author: @lunny
不知道有没有解决你的问题?@Shuenhoy
Author: @lunny
Now, you can use the below code to add a middleware to a group. All the handlers could be add to group.