HTTP Shutdown
JSON →http-shutdown is a Node.js library designed for gracefully shutting down HTTP servers, addressing shortcomings of the native `server.close()` method. Unlike `server.close()` which only terminates the listening socket and waits for existing connections, `http-shutdown` actively closes idle keep-alive sockets and waits for all in-flight requests to complete before closing their associated sockets. This ensures no new requests are accepted and all current requests finish cleanly. The library, currently at version 1.2.2, appears to be in a maintenance phase with infrequent but stable releases. It offers two primary integration methods: explicitly wrapping an `http.Server` instance or extending the `http.Server` prototype with a `withShutdown()` method. It ships with TypeScript types, facilitating its use in modern TypeScript projects.
Traffic · last 30 days ↑200% vs prev 7d
top countries 🇺🇸 United States · 🇫🇷 France · 🇨🇦 Canada · 🇩🇪 Germany