@tinyhttp/app
Advanced tools
Comparing version 1.3.14 to 1.3.15
@@ -223,2 +223,3 @@ import { STATUS_CODES, createServer } from 'http'; | ||
use(...args) { | ||
var _a; | ||
const base = args[0]; | ||
@@ -254,2 +255,16 @@ const fns = args.slice(1).flat(); | ||
else { | ||
const handlerPaths = []; | ||
const handlerFunctions = []; | ||
for (const fn of fns) { | ||
if (fn instanceof App && ((_a = fn.middleware) === null || _a === void 0 ? void 0 : _a.length)) { | ||
for (const mw of fn.middleware) { | ||
handlerPaths.push(lead(base) + lead(mw.path)); | ||
handlerFunctions.push(fn); | ||
} | ||
} | ||
else { | ||
handlerPaths.push(''); | ||
handlerFunctions.push(fn); | ||
} | ||
} | ||
pushMiddleware(this.middleware)({ | ||
@@ -259,7 +274,5 @@ path: base, | ||
type: 'mw', | ||
handler: mount(fns[0]), | ||
handlers: fns.slice(1).map(mount), | ||
fullPaths: fns | ||
.flat() | ||
.map((fn) => { var _a, _b; return fn instanceof App && ((_a = fn.middleware) === null || _a === void 0 ? void 0 : _a[0]) ? lead(base) + lead((_b = fn.middleware) === null || _b === void 0 ? void 0 : _b[0].path) : ''; }) | ||
handler: mount(handlerFunctions[0]), | ||
handlers: handlerFunctions.slice(1).map(mount), | ||
fullPaths: handlerPaths | ||
}); | ||
@@ -266,0 +279,0 @@ } |
{ | ||
"name": "@tinyhttp/app", | ||
"version": "1.3.14", | ||
"version": "1.3.15", | ||
"description": "0-legacy, tiny & fast web framework as a replacement of Express", | ||
@@ -47,3 +47,3 @@ "type": "module", | ||
"@tinyhttp/req": "1.3.1", | ||
"@tinyhttp/res": "1.3.2", | ||
"@tinyhttp/res": "1.3.3", | ||
"@tinyhttp/router": "1.3.3", | ||
@@ -50,0 +50,0 @@ "regexparam": "^2.0.0" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41323
996
+ Added@tinyhttp/res@1.3.3(transitive)
+ Added@tinyhttp/send@1.3.2(transitive)
- Removed@tinyhttp/res@1.3.2(transitive)
- Removed@tinyhttp/send@1.3.1(transitive)
Updated@tinyhttp/res@1.3.3