curl -X GET "http://localhost:8080/health" \ -H "Content-Type: application/json"
{ "status": "healthy", "service": "supabase-auth-service", "version": "1.0.0", "timestamp": "2025-05-30T00:00:00Z" }
Returns service health status and basic information
# Example Kubernetes liveness probe livenessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 30 periodSeconds: 10
// Example service discovery check async function checkServiceHealth(serviceUrl) { try { const response = await fetch(`${serviceUrl}/health`); const health = await response.json(); return health.status === 'healthy'; } catch (error) { return false; } }
# Example monitoring script #!/bin/bash HEALTH_URL="http://localhost:8080/health" RESPONSE=$(curl -s $HEALTH_URL) STATUS=$(echo $RESPONSE | jq -r '.status') if [ "$STATUS" != "healthy" ]; then echo "Service is unhealthy: $RESPONSE" # Send alert exit 1 fi echo "Service is healthy"
# Dockerfile example HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8080/health || exit 1