Fastify TypeScript series wraps up with graceful shutdown and readiness checks
The final chapter of a Fastify with TypeScript series covers deploying the app to production. It shows how to shut down gracefully on SIGTERM or Ctrl-C by using close-with-grace to run app.close(), which drains in-flight requests and the database pool before exit. It also adds a /health/ready endpoint that reports 503 when the database is unreachable, while /health stays dependency-free so an outage does not trigger restart loops. The author demonstrates that readiness recovers automatically once the database returns, thanks to the pool's error listener. The chapter closes with a readiness test and a brief recap of the series' principles.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in