chg Routing again

This commit is contained in:
$(pass /github/name)
2024-09-20 08:24:42 +02:00
parent 81e9068eba
commit 31c47270ab

View File

@@ -15,21 +15,18 @@ func RegisterRoutes(router *gin.Engine, userController *controllers.UserControll
router.POST("/users/login", userController.LoginHandler) router.POST("/users/login", userController.LoginHandler)
router.POST("/csp-report", middlewares.CSPReportHandling) router.POST("/csp-report", middlewares.CSPReportHandling)
// create subrouter for teh authenticated area /account
// also pthprefix matches everything below /account
// accountRouter := router.PathPrefix("/account").Subrouter()
// accountRouter.Use(middlewares.AuthMiddleware)
//create api key required router
apiRouter := router.Group("/api") apiRouter := router.Group("/api")
apiRouter.Use(middlewares.APIKeyMiddleware())
{ {
router.POST("/v1/subscription", membershipcontroller.RegisterSubscription) router.POST("/v1/subscription", membershipcontroller.RegisterSubscription)
} }
apiRouter.Use(middlewares.APIKeyMiddleware())
authRouter := router.Group("/users/backend") authRouter := router.Group("/backend/users")
authRouter.Use(middlewares.AuthMiddleware()) authRouter.Use(middlewares.AuthMiddleware())
{ {
authRouter.GET("/current-user", userController.CurrentUserHandler) authRouter.GET("/current", userController.CurrentUserHandler)
authRouter.POST("/logout", userController.LogoutHandler) authRouter.POST("/logout", userController.LogoutHandler)
authRouter.PATCH("/update", userController.UpdateHandler)
} }
} }