Node services that ignore SIGTERM get force-killed by orchestrators/compose mid-request, dropping in-flight requests and leaking DB connections; services without health checks cannot be safely load-balanced or restarted.
Fix: Handle SIGTERM/SIGINT: stop accepting new connections (server.close()), finish in-flight requests, then close DB pools and other resources before exiting. Expose a health-check route so the orchestrator knows when the instance is actually ready/alive.
infrastructuregraceful-shutdownhealth-check
References
- https://expressjs.com/en/advanced/healthcheck-graceful-shutdown.html — Documents handling SIGTERM with server.close() and exposing health-check endpoints for orchestrated deployments.