mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 12:42:44 +01:00
Updated Server.ts
Added what to do if 'SIGTERM' is sent to the server for the `/stop` API route
This commit is contained in:
parent
20e68867e3
commit
cf99b95c3d
@ -22,6 +22,14 @@ const cdn = new CDNServer({ server, port, production, app });
|
||||
// @ts-ignore
|
||||
const gateway = new Gateway.Server({ server, port, production });
|
||||
|
||||
//this is what has been added for the /stop API route
|
||||
process.on('SIGTERM', () => {
|
||||
server.close(() => {
|
||||
console.log("Stop API has been successfully POSTed, SIGTERM sent")
|
||||
})
|
||||
})
|
||||
//this is what has been added for the /stop API route
|
||||
|
||||
async function main() {
|
||||
server.listen(port);
|
||||
await initDatabase();
|
||||
|
Loading…
Reference in New Issue
Block a user