Make /stop route not ugly as hell

This commit is contained in:
Madeline
2022-10-26 19:50:51 +11:00
parent 070b193987
commit 5f0d16d4bf
2 changed files with 8 additions and 27 deletions
+3 -6
View File
@@ -21,13 +21,10 @@ const api = new Api.FosscordServer({ server, port, production, app });
const cdn = new CDNServer({ server, port, production, app });
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");
});
process.on("SIGTERM", async () => {
console.log("Shutting down due to SIGTERM");
server.close();
});
//this is what has been added for the /stop API route
async function main() {
await initDatabase();