Files
warpbox-dev/backend/libs/handlers/health.go

25 lines
430 B
Go
Raw Normal View History

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),
})
}