Handle SIGTERM
This commit is contained in:
parent
83a47007b0
commit
bde9cf0596
7
index.js
7
index.js
@ -18,3 +18,10 @@ const httpServer = http.createServer(app);
|
|||||||
httpServer.listen(port, null, () => {
|
httpServer.listen(port, null, () => {
|
||||||
console.log(`HTTP server started: http://localhost:${port}`);
|
console.log(`HTTP server started: http://localhost:${port}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle graceful shutdown
|
||||||
|
process.on('SIGTERM', () => {
|
||||||
|
httpServer.close(() => {
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user