mu-koan-server
Graceful shutdown decorator for node's http(s) server
Last updated 4 years ago by nfantone .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mu-koan-server 
SYNC missed versions from official npm registry.

mu-kōän-server 公案-閉鎖

Build Status

Graceful shutdown decorator for node's http(s) server

npm i --save mu-koan-server

js-semistandard-style

Usage

Wrap an instance of a server implementation (such as node's http or https) with a custom shutdown function that enables graceful termination of pending requests before killing the process by calling the createServer exported function.

'use strict';
/**
 * Configures a Koa app and exports 
 * a decorated node `https` server.
 */
const Koa = require('koa');
const server = require('mu-koan-server');

// Create Koa app instance
let app = new Koa();

// Create https server and export it
module.exports = server.createServer(app, {
  // Time (ms) before forced shutdown.
  // Default: 5000
  timeout: 2000,
  // Server implementation to use.
  // Default: `http`
  provider: require('https')
});

The returned server uses app.callback() as its request listener.


License

MIT

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

1 Versions

  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (4)
Dev Dependencies (17)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |