-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
30 lines (26 loc) · 874 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require("./socketStuff/default.js");
require("./expressStuff/app.js");
const expressServer = require("./server.js");
process.on("uncaughtException", (error) => {
// Need to shut down the application and the server immediately.
console.log("Shutting down the server and the application immediately");
console.log(error.message);
console.log(error);
process.exit(1);
});
process.on("unhandledRejection", (error) => {
// Need to shut down the application and the server gracefuly.
console.log("Shutting down the server and the application");
console.log(error.message);
console.log(error);
expressServer.close(() => {
process.exit(1);
});
});
// Handling Sigterm signals
process.on("SIGTERM", () => {
console.log("SIGTERM recieved");
server.close(() => {
console.log("Terminating the application");
});
});