Skip to content

lastcallGraceful shutdown for Node.js

Register cleanup handlers, drain HTTP servers, and exit cleanly on SIGTERM — full line coverage with integration tests via child processes

lastcall logo

Quick example

ts
import { createLastcall } from 'lastcall';

const lastcall = createLastcall();

lastcall.withHttpServer(server);
lastcall.register(
  'database',
  async () => {
    await db.disconnect();
  },
  { critical: true, phase: 'cleanup' },
);

Send SIGTERM — lastcall runs your handlers in order and exits.