@trayio/express 5.11.0 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import http = require('http');
|
|
3
|
+
import { Server } from 'node:http';
|
|
3
4
|
import { ExpressHttpController } from './ExpressHttpController';
|
|
4
5
|
interface ExpressServerOptions {
|
|
5
6
|
port?: number;
|
|
6
7
|
shutdownTimeoutMillis?: number;
|
|
7
8
|
shutdownDelayMillis?: number;
|
|
8
|
-
customShutdownHook?: () => undefined;
|
|
9
|
+
customShutdownHook?: (server: Server<typeof http.IncomingMessage, typeof http.ServerResponse>) => undefined;
|
|
9
10
|
}
|
|
10
11
|
export declare const startServer: (controllers: ExpressHttpController[], options: ExpressServerOptions) => http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
11
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressHttpServer.d.ts","sourceRoot":"","sources":["../../src/http/ExpressHttpServer.ts"],"names":[],"mappings":";AAEA,OAAO,IAAI,GAAG,QAAQ,MAAM,CAAC,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,UAAU,oBAAoB;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpressHttpServer.d.ts","sourceRoot":"","sources":["../../src/http/ExpressHttpServer.ts"],"names":[],"mappings":";AAEA,OAAO,IAAI,GAAG,QAAQ,MAAM,CAAC,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,UAAU,oBAAoB;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,CACpB,MAAM,EAAE,MAAM,CAAC,OAAO,IAAI,CAAC,eAAe,EAAE,OAAO,IAAI,CAAC,cAAc,CAAC,KACnE,SAAS,CAAC;CACf;AAED,eAAO,MAAM,WAAW,gBACV,qBAAqB,EAAE,WAC3B,oBAAoB,yEA6D7B,CAAC"}
|
|
@@ -23,9 +23,11 @@ const startServer = (controllers, options) => {
|
|
|
23
23
|
const server = app.listen(port, () => {
|
|
24
24
|
console.log(`Web server listening on port ${port}`);
|
|
25
25
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
if (options.customShutdownHook) {
|
|
27
|
+
process.on('SIGTERM', () => options.customShutdownHook(server));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
process.on('SIGTERM', () => {
|
|
29
31
|
console.log('Received kill signal, shutting down gracefully...');
|
|
30
32
|
server.close(() => {
|
|
31
33
|
const shutdownDelayMillis = options.shutdownDelayMillis || 500;
|
|
@@ -40,6 +42,7 @@ const startServer = (controllers, options) => {
|
|
|
40
42
|
process.exit(1);
|
|
41
43
|
}, options.shutdownTimeoutMillis || 10000);
|
|
42
44
|
});
|
|
45
|
+
}
|
|
43
46
|
return server;
|
|
44
47
|
};
|
|
45
48
|
exports.startServer = startServer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayio/express",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.0",
|
|
4
4
|
"description": "Express extensions and implementations",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": "./dist/*.js"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@trayio/commons": "5.
|
|
17
|
+
"@trayio/commons": "5.12.0",
|
|
18
18
|
"cors": "2.8.5",
|
|
19
19
|
"express": "4.20.0",
|
|
20
20
|
"formidable": "3.5.1"
|