express-graceful-shutdown
v1.1.3
Published
Ensure that during shutdown express returns correctly with a 503
Downloads
1,052
Readme
express-graceful-shutdown
Ensure that during shutdown express returns correctly with a 503
Installation
npm install express-graceful-shutdown --save
Options
logger
: a logger that providesinfo
,warn
, anderror
functions for recording graceful shutdown. Default:console
.forceTimeout
: number of milliseconds to wait forserver.close()
to complete before callingprocess.exit(1)
. Default:30000
.
Usage
var express = require('express'),
app = express(),
createGracefulShutdownMiddleware = require('express-graceful-shutdown'),
http = require('http'),
server = http.createServer(app)
app.use(createGracefulShutdownMiddleware(server, { forceTimeout: 30000 }))
app.get('/', function(req, res) {
res.json({ foo: 'bar' })
})
server.listen(3000)
Prettier
This project uses prettier for code formatting and linting. You can set prettier
up to auto format code in your editor,
or manually format code before committing with yarn prettier
.
Credits
Paul Serby follow me on twitter @serby
License
Licensed under the ISC