🔔
Last call metaphor
Finish in-flight work, then shut down — like closing time at a bar
Register cleanup handlers, drain HTTP servers, and exit cleanly on SIGTERM — full line coverage with integration tests via child processes
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.