From cf99b95c3d76d5a546949b9303a810b406241fd5 Mon Sep 17 00:00:00 2001 From: unknownPerson115 <69736850+unknownPerson115@users.noreply.github.com> Date: Sat, 25 Dec 2021 21:04:56 +0000 Subject: Updated Server.ts Added what to do if 'SIGTERM' is sent to the server for the `/stop` API route --- bundle/src/Server.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bundle/src') 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(); -- cgit 1.5.1