Files
tp/main_dc/yalarba/api_yal/internal/router/router.go
T
valitovgaziz 9a3ff9ad3d modified: main_dc/docker-compose.yml
modified:   main_dc/yalarba/api_yal/internal/router/router.go
change check path to health, delete router auth (for check)
2026-03-03 14:05:08 +05:00

26 lines
530 B
Go

package router
import (
"api_yal/internal/config"
"api_yal/internal/logger"
"encoding/json"
"net/http"
"github.com/go-chi/chi"
"gorm.io/gorm"
)
func SetupRouter(db *gorm.DB, config *config.Config) http.Handler {
zapLogger := logger.Get()
zapLogger.Info("Start setup routers")
r := chi.NewRouter()
// Health check
r.Get("/health", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"status": "healthy"})
})
return r
}