summary refs log tree commit diff
path: root/bundle/src
diff options
context:
space:
mode:
authorunknownPerson115 <69736850+unknownPerson115@users.noreply.github.com>2021-12-25 21:04:56 +0000
committerGitHub <noreply@github.com>2021-12-25 21:04:56 +0000
commitcf99b95c3d76d5a546949b9303a810b406241fd5 (patch)
treef687c2f1abfe556f300e618fd94bae3c856dc94e /bundle/src
parentMerge pull request #556 from Thesourtimes/master (diff)
downloadserver-cf99b95c3d76d5a546949b9303a810b406241fd5.tar.xz
Updated Server.ts
Added what to do if 'SIGTERM' is sent to the server for the `/stop` API route
Diffstat (limited to 'bundle/src')
-rw-r--r--bundle/src/Server.ts8
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();