summary refs log tree commit diff
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
commitedcac833a8b1ccb9fd166e4e8bb3faaedaddbc9e (patch)
treecd3fc198a35b4afb133c58462464e35420597b91
parentMerge pull request #556 from Thesourtimes/master (diff)
downloadserver-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.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();