Health Check
noun
say it: “HELTH CHEK” /hɛlθ tʃɛk/
A small address on an app that reports whether it is working, so a host or a monitor can check it automatically.
What is a health check route in an API?
A health check is a route such as GET /health that a host calls to ask "are you working?". It answers 200 when the app can do its job and 503 when it can't, such as when its database isn't answering, so the host can wait or restart it.
app.get("/health", async (req, res) => {
try {
await db.command({ ping: 1 });
res.json({ status: "ok" });
} catch {
res.status(503).json({ status: "database unavailable" });
}
});
In a sentence
- “Render calls the trail API's health check and waits for 200 before sending it traffic.”
- “The health check answered 503 while the database was down.”
Level: Journeyman · More REST API terms at this level
Updated