@increase21/simplenodejs 1.0.25 → 1.0.27
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/dist/server.js
CHANGED
|
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CreateSimpleJsHttpsServer = exports.CreateSimpleJsHttpServer = void 0;
|
|
7
7
|
const http_1 = __importDefault(require("http"));
|
|
8
8
|
const node_https_1 = __importDefault(require("node:https"));
|
|
9
|
-
const node_querystring_1 = __importDefault(require("node:querystring"));
|
|
10
|
-
const router_1 = require("./router");
|
|
11
9
|
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
10
|
+
const router_1 = require("./router");
|
|
12
11
|
const helpers_1 = require("./utils/helpers");
|
|
13
12
|
const extension = (req, res) => {
|
|
14
13
|
res.status = (code) => {
|
|
@@ -26,10 +25,9 @@ const extension = (req, res) => {
|
|
|
26
25
|
res.end(param);
|
|
27
26
|
};
|
|
28
27
|
const url = new URL(req.url, "http://localhost");
|
|
29
|
-
req.query = url.search ?
|
|
28
|
+
req.query = url.search ? Object.fromEntries(url.searchParams.entries()) : {};
|
|
30
29
|
req._end_point_path = url.pathname.replace(/^\/+|\/+$/g, "").split("/");
|
|
31
|
-
|
|
32
|
-
res.setHeader("X-Request-Id", req.id);
|
|
30
|
+
res.setHeader("X-Request-Id", node_crypto_1.default.randomUUID());
|
|
33
31
|
};
|
|
34
32
|
function buildRequestHandler(middlewares, errorMiddlewares) {
|
|
35
33
|
return async (req, res) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpMethod, SimpleJsPrivateMethodProps } from "./general";
|
|
1
|
+
import { HttpMethod, RequestObject, SimpleJsPrivateMethodProps } from "./general";
|
|
2
2
|
export type SimpleJSRateLimitType = {
|
|
3
3
|
windowMs: number;
|
|
4
4
|
max: number;
|
|
@@ -12,7 +12,7 @@ export type SimpleJSBodyParseType = {
|
|
|
12
12
|
* Accepts a list of path prefixes or a predicate function.
|
|
13
13
|
* Multipart requests are always skipped regardless of this option.
|
|
14
14
|
*/
|
|
15
|
-
ignoreStream?: string[] | ((req:
|
|
15
|
+
ignoreStream?: string[] | ((req: RequestObject) => boolean);
|
|
16
16
|
};
|
|
17
17
|
export interface SimpleJsControllerMeta {
|
|
18
18
|
name: string;
|
|
@@ -8,10 +8,7 @@ export declare class SimpleNodeJsController {
|
|
|
8
8
|
protected method: HttpMethod;
|
|
9
9
|
protected _custom_data: any;
|
|
10
10
|
/** @internal */
|
|
11
|
-
__bindContext
|
|
12
|
-
req: RequestObject;
|
|
13
|
-
res: ResponseObject;
|
|
14
|
-
}): void;
|
|
11
|
+
private __bindContext;
|
|
15
12
|
protected __checkContext(): void;
|
|
16
13
|
protected __run(handlers: SubRequestHandler): SubRequestHandler;
|
|
17
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@increase21/simplenodejs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "Lightweight Node.js HTTP framework with middlewares and plugins",
|
|
5
5
|
"dev": "dist/index.js",
|
|
6
6
|
"bugs": "https://github.com/increase21/simplenodejs/issues",
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
],
|
|
35
35
|
"author": "Increase Nkanta",
|
|
36
36
|
"license": "MIT",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@types/node": "^20.0.0"
|
|
39
|
+
},
|
|
37
40
|
"devDependencies": {
|
|
38
41
|
"typescript": "^5.3.0"
|
|
39
42
|
}
|