moar-js
Version:
Simple JavaScript files I use across projects
13 lines (12 loc) • 373 B
JavaScript
module.exports = ({app}) => {
process.on('SIGINT', async () => {
app.log?.debug('SIGINT received: Shutdown server...')
await app.close()
app.log?.info('Server shutdown completed. Exiting process now.')
// eslint-disable-next-line no-process-exit
return process.exit(0)
})
process.on('SIGTERM', event => {
app.log.warn('SIGTERM', event)
})
}