handle signals #192

This commit is contained in:
Jan Prochazka 2021-12-28 16:58:22 +01:00
parent 92d160b077
commit 66cac0665d

View File

@ -124,6 +124,18 @@ function start() {
console.log('DbGate API listening on port', port);
server.listen(port);
}
function shutdown() {
console.log('\nShutting down DbGate API server');
server.close( ()=> {
console.log('Server shut down, terminating');
process.exit(0);
});
}
process.on('SIGINT', shutdown);
process.on('SIGTERM', shutdown);
process.on('SIGBREAK', shutdown);
}
function useAllControllers(app, electron) {