-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (28 loc) · 966 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
31
32
33
34
require('dotenv').config();
const { createHttpServer } = require('./api/server');
(async () => {
const server = await createHttpServer();
const port = process.env.PORT || 3301;
process.on('uncaughtException', (err) => {
console.error(`${(new Date()).toUTCString()} uncaughtException:`, err);
process.exit(0);
});
process.on('SIGINT', (err) => {
console.error(`${(new Date()).toUTCString()} SIGINT:`, err);
process.exit(0);
});
process.on('SIGTERM', (err) => {
console.error(`${(new Date()).toUTCString()} SIGTERM:`, err);
process.exit(0);
});
process.on('ELIFECYCLE', (err) => {
console.error(`${(new Date()).toUTCString()} ELIFECYCLE:`, err);
process.exit(0);
});
process.on('unhandledRejection', (err) => {
console.error(`${(new Date()).toUTCString()} unhandledRejection:`, err);
});
server.listen({ port }, () => console.log(
`🚀 Server ready at http://localhost:${port}/api`,
));
})();