Socket
Socket
Sign inDemoInstall

server-terminate

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

server-terminate - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="1.4.0"></a>
# [1.4.0](https://github.com/Telefonica/node-server-terminate/compare/v1.3.1...v1.4.0) (2016-09-23)
### Features
* Add support for ES6 imports (#3) ([c8d17c4](https://github.com/Telefonica/node-server-terminate/commit/c8d17c4))
<a name="1.3.1"></a>

@@ -2,0 +12,0 @@ ## [1.3.1](https://github.com/Telefonica/node-server-terminate/compare/v1.3.0...v1.3.1) (2016-09-01)

21

index.d.ts

@@ -1,4 +0,13 @@

import * as http from 'http';
/**
* Allow terminating an HTTP server in an orderly fashion
*/
import { Server } from 'http';
declare function enableTerminate(server: http.Server, opts?: Options): http.Server;
interface enableTerminateSignature {
/** Adds the `terminate` function to the provided server instance */
(server: Server, opts?: Options): Server;
default: enableTerminateSignature;
}
declare var enableTerminate: enableTerminateSignature;
export = enableTerminate;

@@ -12,4 +21,10 @@

export interface Server {
terminate(cb: (err: Error, terminatedByTimeout: boolean) => void): Server;
/**
* Terminates the server in an orderly fashion by
* - closing keep-alive connections that are not being used by any HTTP request.
* - waiting for running HTTP requests to finish before closing their connections.
* - closing connections with running HTTP requests after the provided timeout
*/
terminate(cb: (err: Error, terminatedByTimeout: boolean) => any): Server;
}
}

10

index.js

@@ -29,3 +29,9 @@ /*

module.exports = function enableTerminate(server, opts) {
module.exports = enableTerminate;
// Support for ES6 imports.
// Now you can make `import enableTerminate from 'enable-terminate'`
// and get a reference to this function
enableTerminate.default = enableTerminate;
function enableTerminate(server, opts) {
opts = opts || {};

@@ -105,2 +111,2 @@ opts.timeout = opts.timeout || 30 * 1000;

return server;
};
}
{
"name": "server-terminate",
"version": "1.3.1",
"version": "1.4.0",
"description": "Allow terminating a server in an orderly fashion",

@@ -8,3 +8,4 @@ "license": "MIT",

"contributors": [
"Javier Martínez Álvarez <javier.martinezalvarez@telefonica.com>"
"Javier Martínez Álvarez <javier.martinezalvarez@telefonica.com>",
"Javier Mendiara Cañardo <javier.mendiaracanardo@telefonica.com>"
],

@@ -34,2 +35,3 @@ "main": "index",

"devDependencies": {
"@types/node": "^6.0.40",
"chai": "^3.5.0",

@@ -43,5 +45,4 @@ "conventional-changelog-cli": "^1.2.0",

"tslint-config-typings": "^0.2.3",
"typescript": "^1.8.10",
"typings": "^1.3.3"
"typescript": "^2.0.3"
}
}
# server-terminate
![TypeScript definition](https://img.shields.io/badge/TypeScript%20Definition-%E2%9C%93-blue.svg)
Allow terminating an HTTP server in an orderly fashion:

@@ -35,3 +38,3 @@ * Immediately closes keep-alive connections that are not being used by any HTTP request.

import * as http from 'http';
import enableTerminate = require('server-terminate');
import enableTerminate from 'server-terminate';

@@ -38,0 +41,0 @@ let server: http.Server = http.createServer(function onRequest(req: http.ServerRequest, res: http.ServerResponse) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc