Files
warpbox-dev/backend/libs/handlers/health.go
Daniel Legt 6c87187c6d
All checks were successful
Build and Publish Docker Image / deploy (push) Successful in 1m44s
refactor(api): consolidate health check endpoints to /health
Removes the redundant `/healthz` and `/api/v1/health` endpoints, leaving `/health` as the sole health check endpoint.

- Update router to return 404 Not Found for the removed endpoints
- Update admin log filtering to only ignore `/health`
- Remove health URL from API documentation data
- Update tests to verify `/health` returns 200 and others return 404
- Update README documentation to reflect the change
2026-06-02 11:54:38 +03:00

25 lines
430 B
Go

package handlers
import (
"net/http"
"time"
"warpbox.dev/backend/libs/helpers"
)
type healthResponse struct {
Status string `json:"status"`
Time string `json:"time"`
}
func (a *App) Health(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/health" {
http.NotFound(w, r)
return
}
helpers.WriteJSON(w, http.StatusOK, healthResponse{
Status: "ok",
Time: time.Now().UTC().Format(time.RFC3339),
})
}