06d3dbd8b7
modified: main_dc/yalarba/api_yal/internal/router/router.go set router
25 lines
508 B
Go
25 lines
508 B
Go
package router
|
|
|
|
import (
|
|
"api_yal/internal/config"
|
|
"api_yal/internal/logger"
|
|
"encoding/json"
|
|
|
|
"github.com/go-chi/chi"
|
|
)
|
|
|
|
|
|
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_yal", 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
|
|
} |