summary refs log tree commit diff
path: root/bundle/src/Server.ts
diff options
context:
space:
mode:
authorErkin Alp Güney <erkinalp9035@gmail.com>2021-12-26 17:49:15 +0300
committerGitHub <noreply@github.com>2021-12-26 17:49:15 +0300
commit28f25c3593f4a2ceb39c1d28a5c09dba316a96c1 (patch)
tree25d4709a3882fd322cec173b6afa7e2209e88ee7 /bundle/src/Server.ts
parentMerge pull request #556 from Thesourtimes/master (diff)
parentUpdate api/src/routes/stop.ts (diff)
downloadserver-28f25c3593f4a2ceb39c1d28a5c09dba316a96c1.tar.xz
Initial implementation of the remote server shutdown route
Diffstat (limited to 'bundle/src/Server.ts')
-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();