@strv/heimdall
The process lifecycle gatekeeper.
Built with ❤️ at STRV
Heimdall takes control over the Node.js process' signal handling and provides a simple way to respond to various process lifecycle events.
Installation
npm i --save @strv/heimdall
Usage
import { heimdall } from '@strv/heimdall'
import { app } from './app'
heimdall({
async execute() {
return await app.start(process.env.PORT)
},
async exit({ runtime }) {
await app.stop()
app === runtime
},
didReceiveForcequit() {
},
logError(err) {
pino.error({ err }, 'heimdall received error')
}
exitAfterExecute?: false
})
License
See the LICENSE file for information.