Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

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
  });
});
Something went wrong with that request. Please try again.