new file: serv_nginx/api_bb/bin/bb_api
modified: serv_nginx/api_bb/internal/routes/routes.go new file: serv_nginx/api_bb/sqlite add bb_api routing check endpoint and create Makefile
This commit is contained in:
Binary file not shown.
@@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
func SetupRouter(db *gorm.DB) http.Handler {
|
func SetupRouter(db *gorm.DB) http.Handler {
|
||||||
r := chi.NewRouter()
|
r := chi.NewRouter()
|
||||||
|
|
||||||
// Apply common middleware
|
// Apply common middleware
|
||||||
for _, m := range middleware.CommonMiddleware() {
|
for _, m := range middleware.CommonMiddleware() {
|
||||||
r.Use(m)
|
r.Use(m)
|
||||||
@@ -22,26 +22,30 @@ func SetupRouter(db *gorm.DB) http.Handler {
|
|||||||
|
|
||||||
// Initialize repositories
|
// Initialize repositories
|
||||||
userRepo := repository.NewUserRepository(db)
|
userRepo := repository.NewUserRepository(db)
|
||||||
|
|
||||||
// Initialize services
|
// Initialize services
|
||||||
authService := service.NewAuthService(userRepo)
|
authService := service.NewAuthService(userRepo)
|
||||||
|
|
||||||
// Initialize handlers
|
// Initialize handlers
|
||||||
healthHandler := handlers.NewHealthHandler()
|
healthHandler := handlers.NewHealthHandler()
|
||||||
authHandler := handlers.NewAuthHandler(authService)
|
authHandler := handlers.NewAuthHandler(authService)
|
||||||
|
|
||||||
// Health routes
|
// Health routes
|
||||||
r.Mount("/api", healthHandler.Routes())
|
r.Mount("/api", healthHandler.Routes())
|
||||||
|
|
||||||
// API v1 routes
|
// API v1 routes
|
||||||
r.Route("/api/v1", func(r chi.Router) {
|
r.Route("/api/v1", func(r chi.Router) {
|
||||||
|
// Add the new /check route
|
||||||
|
r.Get("/check", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
})
|
||||||
r.Mount("/auth", authHandler.Routes())
|
r.Mount("/auth", authHandler.Routes())
|
||||||
|
|
||||||
// Здесь будут добавлены другие маршруты:
|
// Здесь будут добавлены другие маршруты:
|
||||||
// r.Mount("/users", userHandler.Routes())
|
// r.Mount("/users", userHandler.Routes())
|
||||||
// r.Mount("/events", eventHandler.Routes())
|
// r.Mount("/events", eventHandler.Routes())
|
||||||
// r.Mount("/reviews", reviewHandler.Routes())
|
// r.Mount("/reviews", reviewHandler.Routes())
|
||||||
})
|
})
|
||||||
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user