Skip to content

Commit

Permalink
feat: handle graceful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jellydn committed Sep 27, 2023
1 parent 05f08ce commit ddbc00b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import startServer from "./server";
import startServer, { server } from "./server";

startServer().catch(console.error);

// Handle graceful shutdown
const exitHandler = async () => {
await server.close();
process.exit(0);
}

process.on('SIGINT', exitHandler);
process.on('SIGTERM', exitHandler);

0 comments on commit ddbc00b

Please sign in to comment.