@orion-js/http 3.1.13 → 3.1.16
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.
- package/lib/start.d.ts +5 -1
- package/lib/start.js +13 -3
- package/package.json +2 -2
package/lib/start.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/// <reference types="express-serve-static-core" />
|
|
2
2
|
import express from 'express';
|
|
3
|
-
export
|
|
3
|
+
export interface StartOrionOptions {
|
|
4
|
+
keepAliveTimeout?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const startServer: (port?: number, otherOptions?: StartOrionOptions) => express.Express;
|
|
4
7
|
export declare const getApp: () => express.Express;
|
|
8
|
+
export declare const getServer: () => any;
|
package/lib/start.js
CHANGED
|
@@ -3,13 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getApp = exports.startServer = void 0;
|
|
6
|
+
exports.getServer = exports.getApp = exports.startServer = void 0;
|
|
7
7
|
const env_1 = require("@orion-js/env");
|
|
8
8
|
const express_1 = __importDefault(require("express"));
|
|
9
9
|
global.appRef = null;
|
|
10
|
-
|
|
10
|
+
global.serverRef = null;
|
|
11
|
+
const startServer = (port = Number((0, env_1.internalGetEnv)('http_port', 'PORT')), otherOptions = {}) => {
|
|
11
12
|
const app = (0, exports.getApp)();
|
|
12
|
-
app.listen(port);
|
|
13
|
+
const server = app.listen(port);
|
|
14
|
+
global.serverRef = server;
|
|
15
|
+
if (otherOptions.keepAliveTimeout) {
|
|
16
|
+
server.keepAliveTimeout = otherOptions.keepAliveTimeout; // Ensure all inactive connections are terminated by the ALB, by setting this a few seconds higher than the ALB idle timeout
|
|
17
|
+
server.headersTimeout = otherOptions.keepAliveTimeout + 1000;
|
|
18
|
+
}
|
|
13
19
|
return app;
|
|
14
20
|
};
|
|
15
21
|
exports.startServer = startServer;
|
|
@@ -21,3 +27,7 @@ const getApp = () => {
|
|
|
21
27
|
return app;
|
|
22
28
|
};
|
|
23
29
|
exports.getApp = getApp;
|
|
30
|
+
const getServer = () => {
|
|
31
|
+
return global.serverRef;
|
|
32
|
+
};
|
|
33
|
+
exports.getServer = getServer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/http",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.16",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "39bc0352e8e60d81bb4d6184960c7704e03d7d56"
|
|
44
44
|
}
|