In production, a Node process should never be run bare in a terminal: a process manager (PM2, systemd, or a container orchestrator) restarts it on crash, manages logs, and can run multiple instances. A health-check endpoint lets load balancers and orchestrators detect an unhealthy instance and stop routing traffic to it.
js
app.get("/health", (req, res) => {
const healthy = db.isConnected() && rpcIsReachable;
res.status(healthy ? 200 : 503).json({ healthy });
});json
{ "scripts": { "start": "node dist/index.js" } }Zero-downtime deploys start new instances, wait for them to pass health checks, shift traffic over, then gracefully shut down the old instances — never simply killing the old process and starting the new one, which would drop in-flight requests.