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 503 if the readiness check fails.

Simplified URL redirection:

// Single redirect
app.redirect("/old", "/new");
// With status code
app.redirect("/legacy", "/modern", 301);
// Map syntax
app.redirect({
"/old-page": "/new-page",
"/deprecated": "/current"
});
// Array syntax
app.redirect([
["/a", "/b"],
["/c", "/d", 301]
]);