diff options
author | unknownPerson115 <69736850+unknownPerson115@users.noreply.github.com> | 2021-12-25 21:04:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-25 21:04:56 +0000 |
commit | edcac833a8b1ccb9fd166e4e8bb3faaedaddbc9e (patch) | |
tree | cd3fc198a35b4afb133c58462464e35420597b91 | |
parent | Merge pull request #556 from Thesourtimes/master (diff) | |
download | server-edcac833a8b1ccb9fd166e4e8bb3faaedaddbc9e.tar.xz |
Updated Server.ts
Added what to do if 'SIGTERM' is sent to the server for the `/stop` API route
-rw-r--r-- | bundle/src/Server.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts index e461ec5f..c5da5fc9 100644 --- a/bundle/src/Server.ts +++ b/bundle/src/Server.ts @@ -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(); |