modified: serv_nginx/api_bb/internal/routes/routes.go

change to authed router for user
This commit is contained in:
2025-10-11 09:27:02 +05:00
parent 3807d060a8
commit 6ba5d57b68
+8 -1
View File
@@ -43,8 +43,15 @@ func SetupRouter(db *gorm.DB, config *config.Config) http.Handler {
// Public auth routes
r.Mount("/auth", authHandler.Routes())
r.Mount("/user", userHandler.Routes())
// Protected routes
r.Route("/user", func(r chi.Router) {
r.Use(middleware.AuthMiddleware(jwtService, userRepo))
r.Use(middleware.RequireAuth)
r.Mount("/", userHandler.Routes())
// Здесь будут другие защищенные маршруты пользователя
})
// Здесь будут добавлены другие маршруты:
// r.Mount("/events", eventHandler.Routes())