Fix(API): cors middleware hoisting because it doesn't work with r.Group

This commit is contained in:
Dreamacro 2019-09-21 21:28:02 +08:00
parent 8f60d61ff9
commit e0c8aed5c7

View file

@ -52,9 +52,10 @@ func Start(addr string, secret string) {
MaxAge: 300,
})
r.Use(cors.Handler)
r.Get("/", hello)
r.Group(func(r chi.Router) {
r.Use(cors.Handler, authentication)
r.Use(authentication)
r.Get("/logs", getLogs)
r.Get("/traffic", traffic)