Sheet ⁨05⁩ · ⁨Code snippets⁩Surveyed ⁨2026⁩

#Express

Node.js Graceful Shutdown: Handle SIGTERM in Express and Fastify

Node.js Graceful Shutdown: Handle SIGTERM in Express and Fastify

Quick Tip Node's default SIGTERM handler exits immediately, so every deploy kills your in-flight requests. Here's a shutdown handler that drains them properly, in about 80 lines. The Problem