mu-kōän-server 公案-閉鎖
Graceful shutdown decorator for node's http(s) server
npm i --save mu-koan-server
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 = ;const server = ; // Create Koa app instancelet app = ; // Create https server and export itmoduleexports = server;
The returned server uses app.callback()
as its request listener.
License
MIT