-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
35 lines (29 loc) · 748 Bytes
/
server.js
File metadata and controls
35 lines (29 loc) · 748 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
26
27
28
29
30
31
32
33
34
35
const Service = require('./lib/service');
const conf = require('./config');
const config = conf.get();
const service = new Service({
port: config.port,
externalHostname: config.externalHostname
});
async function start() {
try {
await service.start();
} catch (err) {
console.log(err);
process.exit(1);
}
console.log('Server running at:', service.server.info.uri);
console.log('Documentation at:', `${service.server.info.uri}/documentation`);
}
async function stop() {
try {
await service.stop();
} catch (err) {
console.log(err);
process.exit(1);
}
console.log('Server stopped.');
}
start();
process.on('SIGTERM', stop);
process.on('SIGINT', stop);