Node.js module to gracefully shut down an application
Phased graceful shutdown for Node.js — register async cleanup handlers that run in order when your process receives SIGTERM, SIGINT, SIGHUP, or beforeExit.
import { registerHandler } from '@hypercliq/shutdown-cleanup'
registerHandler(async (signal) => {
await server.close()
await db.disconnect()
})
continue (default) or stop on handler failurenpm install @hypercliq/shutdown-cleanup
# or
yarn add @hypercliq/shutdown-cleanup
# or
pnpm add @hypercliq/shutdown-cleanup
Full API reference, phased shutdown examples, signal-specific handlers, error strategies, and best practices in the Developer Guide.