-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathserver.js
More file actions
25 lines (20 loc) · 642 Bytes
/
server.js
File metadata and controls
25 lines (20 loc) · 642 Bytes
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
/**
* Module dependencies.
*/
import chalk from 'chalk';
import path from 'path';
const app = await import(path.resolve('./lib/app.js'));
const { default: logger } = await import(path.resolve('./lib/services/logger.js'));
const server = app.start().catch((e) => {
logger.error(chalk.red(`Server failed`));
logger.error(e.message, e);
throw e;
});
process.on('SIGINT', () => {
logger.info(chalk.blue(' SIGINT Graceful shutdown ', new Date().toISOString()));
app.shutdown(server);
});
process.on('SIGTERM', () => {
logger.info(chalk.blue(' SIGTERM Graceful shutdown ', new Date().toISOString()));
app.shutdown(server);
});