Skip to content

Health Checks

Add a health check endpoint for monitoring and DevOps:

app.healthCheck(); // default: GET /health
app.healthCheck("/status"); // custom path
{
"status": "OK",
"uptime": 123.456,
"pid": 12345,
"timestamp": "2025-01-01T00:00:00.000Z"
}
app.healthCheck({
readinessCheck: async () => {
const dbOk = await checkDatabase();
return { ok: dbOk };
}
});

Returns 200 OK when healthy, 503 Service Unavailable if the readiness check fails.

OptionTypeDescription
pathstringCustom endpoint path (default: /health)
readinessCheckFunctionAsync function returning { ok: boolean }
replacebooleanReplace existing health endpoint (default: false)
includeObjectToggle response fields: uptime, pid, env, timestamp, metrics