diff --git a/http/route/route.go b/http/route/route.go index 22f0282..bad7b97 100644 --- a/http/route/route.go +++ b/http/route/route.go @@ -14,13 +14,15 @@ import ( func Register(server *goyave.Server, router *goyave.Router) { router.CORS(cors.Default()) - router.GlobalMiddleware(log.CombinedLogMiddleware(), &parse.Middleware{}) + router.GlobalMiddleware(log.CombinedLogMiddleware()) userService := server.Service(service.User).(*userservice.Service) authenticator := auth.NewJWTAuthenticator(userService) authMiddleware := auth.Middleware(authenticator) router.GlobalMiddleware(authMiddleware) + router.GlobalMiddleware(&parse.Middleware{}) + loginController := auth.NewJWTController(userService, "Password") loginController.UsernameRequestField = "email" router.Controller(loginController)