diff --git a/index.mjs b/index.mjs index 4ca315e..8c2169b 100644 --- a/index.mjs +++ b/index.mjs @@ -99,8 +99,11 @@ const server = app.listen(port, () => { }); // graceful shutdown -process.on('SIGINT', () => { +const gracefulShutdown = () => { server.close(() => { console.log('Server closed'); }); -}); +}; + +process.on('SIGINT', gracefulShutdown); +process.on('SIGTERM', gracefulShutdown);