Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (21 sloc) 0.594 kB

graceful-exit Build Status

Gracefully exit your node process (e.g., wait for network connections to close).

Installation

npm install graceful-exit

Usage

var http = require('http'),
    gracefulExit = require('graceful-exit')();

http.createServer(function (req, res) {
  gracefulExit();
  setTimeout(function () {
    res.end();
    // Process will exit now.
  }, 1000);
}).listen(8000, function () {
  http.get({
    host: 'localhost',
    port: 8000
  });
});
Jump to Line
Something went wrong with that request. Please try again.