mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
improve http-graceful-shutdown - library should also support https servers (#27028)
* improve http-graceful-shutdown - library should also support https servers, widen typings to accomodate * fix test file * tiny test change to kick off the build, makes it easier to tell what the first parameter is anyway
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import GracefulShutdown = require('http-graceful-shutdown');
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
|
||||
const opts: GracefulShutdown.Options = {
|
||||
signals: "SIGINT SIGTERM",
|
||||
@@ -14,8 +15,16 @@ const opts: GracefulShutdown.Options = {
|
||||
}
|
||||
};
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
const httpServer = http.createServer((req, res) => {
|
||||
res.end();
|
||||
});
|
||||
|
||||
GracefulShutdown(server, opts);
|
||||
const httpsServer = https.createServer({
|
||||
key: new Buffer('foo'),
|
||||
cert: new Buffer('bar')
|
||||
}, (req, res) => {
|
||||
res.end();
|
||||
});
|
||||
|
||||
GracefulShutdown(httpServer, opts);
|
||||
GracefulShutdown(httpsServer, opts);
|
||||
|
||||
+3
-2
@@ -5,9 +5,10 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Server } from "http";
|
||||
import { Server as HttpServer } from "http";
|
||||
import { Server as HttpsServer } from "https";
|
||||
|
||||
declare function GracefulShutdown(server: Server, options?: GracefulShutdown.Options): void;
|
||||
declare function GracefulShutdown(server: HttpServer | HttpsServer, options?: GracefulShutdown.Options): void;
|
||||
|
||||
declare namespace GracefulShutdown {
|
||||
interface Options {
|
||||
|
||||
Reference in New Issue
Block a user