buildout server module

This commit is contained in:
KS Jannette
2026-05-18 17:54:11 -04:00
parent 0fc5773f5d
commit cbd6232b6a

View File

@@ -6,3 +6,13 @@ const app = createApp();
const server = app.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`);
});
function shutdown(signal: string) {
console.log(`${signal} received — shutting down...`);
server.close(() => {
console.log('All connections closed. Exiting.');
process.exit(0);
});
}
process.on('SIGTERM', () => shutdown('SIGTERM'));
process.on('SIGINT', () => shutdown('SIGINT'));