forked from owstack/payment-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
33 lines (27 loc) · 639 Bytes
/
server.js
File metadata and controls
33 lines (27 loc) · 639 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
const Service = require('./lib/service');
const config = require('config');
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);
}
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);