Files
browser/platform/api/health_handler.go
T
2026-07-11 14:56:10 +08:00

33 lines
716 B
Go

package api
import (
"encoding/json"
"net/http"
"time"
"browser.local/platform/dto"
)
const serviceVersion = "0.1.0-dev"
// HealthHandler godoc
// @Summary Platform health
// @Description Returns process health for local development smoke tests.
// @Tags health
// @Success 200 {object} dto.HealthResponse
// @Router /healthz [get]
func HealthHandler(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
writeMethodNotAllowed(w, http.MethodGet)
return
}
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(dto.HealthResponse{
Service: "platform",
Status: "ok",
Version: serviceVersion,
Time: time.Now().UTC().Format(time.RFC3339),
})
}