Skip to content

Commit

Permalink
Fix shutdown on SIGINT
Browse files Browse the repository at this point in the history
  • Loading branch information
gnmyt committed Aug 30, 2024
1 parent 09894f9 commit eb142a3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,12 @@ db.authenticate().catch(err => {
await db.sync({ alter: true, force: false });

app.listen(APP_PORT, () => console.log(`Server listening on port ${APP_PORT}`));
});

process.on("SIGINT", async () => {
console.log("Shutting down the server...");

await db.close();

process.exit(0);
});

0 comments on commit eb142a3

Please sign in to comment.