Files
tp/main_dc/yalarba/api_yal/internal/router/router.go
T
2026-02-28 05:41:58 +05:00

27 lines
532 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
}