e436647091
modified: main_dc/yalarba/api_es/internal/handler/all_handlers.go new file: main_dc/yalarba/api_es/internal/handler/health.go modified: main_dc/yalarba/api_es/internal/router/router.go new file: main_dc/yalarba/api_es/internal/utils/formatTime.go new file: main_dc/yalarba/api_es/internal/utils/response.go new file: main_dc/yalarba/api_es/internal/utils/utils.go new file: main_dc/yalarba/api_es/internal/utils/validation.go add utils and health check heandlers into routes
31 lines
650 B
Go
31 lines
650 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"api_es/internal/utils"
|
|
|
|
)
|
|
|
|
type HealthHandler struct{}
|
|
|
|
func NewHealthHandler() *HealthHandler {
|
|
return &HealthHandler{}
|
|
}
|
|
|
|
func (h *HealthHandler) HealthCheck(w http.ResponseWriter, r *http.Request) {
|
|
response := map[string]string{
|
|
"status": "ok",
|
|
"message": "Service is healthy",
|
|
}
|
|
utils.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",
|
|
}
|
|
|
|
utils.RespondWithJSON(w, http.StatusOK, response)
|
|
} |