first commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user