Health Check
A simple endpoint for monitoring and load balancer health probes.
Endpoint
GET /healthz
Healthy response
{
"status": "ok"
}
HTTP status: 200 OK
Unhealthy response
{
"status": "error",
"detail": "database connection failed"
}
HTTP status: 503 Service Unavailable
Usage
# Simple check
curl -f http://localhost:8080/healthz
# In a Docker healthcheck
HEALTHCHECK CMD curl -f http://localhost:8080/healthz || exit 1
# Kubernetes liveness probe
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 10