Last Updated: May 22, 2026
A long-running HTTP server has to stop eventually: a deploy, a config change, a crash, or a Ctrl+C during local dev. If you stop it the wrong way, in-flight requests die mid-write, payment confirmations never reach the client, and database transactions are abandoned half-done. Graceful shutdown is the pattern that lets the server stop accepting new work, finish what it already started, and exit cleanly.