654c682b05
modified: serv_nginx/api_bb/internal/handlers/health.go fix bachground photo path
40 lines
813 B
Go
40 lines
813 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
)
|
|
|
|
type HealthHandler struct{}
|
|
|
|
func NewHealthHandler() *HealthHandler {
|
|
return &HealthHandler{}
|
|
}
|
|
|
|
func (h *HealthHandler) Routes() chi.Router {
|
|
r := chi.NewRouter()
|
|
|
|
r.Get("/health", h.HealthCheck)
|
|
r.Get("/check", h.Check)
|
|
|
|
return r
|
|
}
|
|
|
|
func (h *HealthHandler) HealthCheck(w http.ResponseWriter, r *http.Request) {
|
|
response := map[string]string{
|
|
"status": "ok",
|
|
"message": "Service is healthy",
|
|
}
|
|
|
|
respondWithJSON(w, http.StatusOK, response)
|
|
}
|
|
|
|
func (h *HealthHandler) Check(w http.ResponseWriter, r *http.Request) {
|
|
response := map[string]string{
|
|
"status": "ok",
|
|
"message": "API is working",
|
|
}
|
|
|
|
respondWithJSON(w, http.StatusOK, response)
|
|
} |