1
0
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:
unknownPerson115 2021-12-25 21:04:56 +00:00 committed by GitHub
parent 20e68867e3
commit cf99b95c3d

View File

@ -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();