serby / express-graceful-shutdown

Ensure that during shutdown express returns correctly with a 503
ISC License
20 stars 7 forks source link

express-graceful-shutdown

Ensure that during shutdown express returns correctly with a 503

build status

Installation

npm install express-graceful-shutdown --save

Options

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