You've already forked healthcheck
This commit is contained in:
23
server.js
23
server.js
@@ -51,6 +51,23 @@ app.get('/health/:service', async (req, res) => {
|
||||
|
||||
app.use((_, response) => response.sendStatus(404))
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Health Check Proxy listening on port ${PORT}`)
|
||||
})
|
||||
const server = app.listen(PORT, () => {
|
||||
console.log(`@syncraft/healthcheck listening on port ${PORT}`)
|
||||
})
|
||||
|
||||
const shutdown_handler = (signal) => {
|
||||
console.log(`${signal} received. Initiating graceful shutdown.`)
|
||||
|
||||
server.close((error) => {
|
||||
if (error) {
|
||||
console.error('Error during HTTP server close:', error)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('HTTP server closed. Exiting process.')
|
||||
process.exit(0)
|
||||
});
|
||||
}
|
||||
|
||||
process.on('SIGTERM', () => shutdown_handler('SIGTERM'))
|
||||
process.on('SIGINT', () => shutdown_handler('SIGINT'))
|
||||
Reference in New Issue
Block a user