modified: serv_nginx/api_bb/internal/routes/routes.go
change to authed router for user
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user