router-http 1.0.8 → 1.0.10
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/README.md +1 -1
- package/package.json +9 -7
- package/src/index.js +8 -4
package/README.md
CHANGED
|
@@ -175,4 +175,4 @@ Full credits to [Luke Edwards](https://github.com/lukeed) for writing [Polka](ht
|
|
|
175
175
|
**router-http** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/Kikobeats/router-http/blob/master/LICENSE.md) License.<br>
|
|
176
176
|
Authored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/Kikobeats/router-http/contributors).
|
|
177
177
|
|
|
178
|
-
> [kikobeats.com](https://kikobeats.com) · GitHub [Kiko Beats](https://github.com/Kikobeats) ·
|
|
178
|
+
> [kikobeats.com](https://kikobeats.com) · GitHub [Kiko Beats](https://github.com/Kikobeats) · X [@Kikobeats](https://x.com/Kikobeats)
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "router-http",
|
|
3
3
|
"description": "Simple HTTP router compatible with Express",
|
|
4
4
|
"homepage": "https://github.com/Kikobeats/router-http",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.10",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "josefrancisco.verdu@gmail.com",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"github-generate-release": "latest",
|
|
44
44
|
"got": "11",
|
|
45
45
|
"nano-staged": "latest",
|
|
46
|
-
"npm-check-updates": "latest",
|
|
47
46
|
"simple-git-hooks": "latest",
|
|
48
47
|
"standard": "latest",
|
|
49
48
|
"standard-markdown": "latest",
|
|
@@ -61,20 +60,23 @@
|
|
|
61
60
|
"coverage": "c8 report --reporter=text-lcov > coverage/lcov.info",
|
|
62
61
|
"lint": "standard-markdown README.md && standard",
|
|
63
62
|
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
|
|
64
|
-
"prerelease": "npm run
|
|
63
|
+
"prerelease": "npm run contributors",
|
|
65
64
|
"pretest": "npm run lint",
|
|
66
65
|
"release": "standard-version -a",
|
|
67
66
|
"release:github": "github-generate-release",
|
|
68
67
|
"release:tags": "git push --follow-tags origin HEAD:master",
|
|
69
|
-
"test": "c8 ava"
|
|
70
|
-
"update": "ncu -u",
|
|
71
|
-
"update:check": "ncu -- --error-level 2"
|
|
68
|
+
"test": "c8 ava"
|
|
72
69
|
},
|
|
73
70
|
"license": "MIT",
|
|
74
71
|
"commitlint": {
|
|
75
72
|
"extends": [
|
|
76
73
|
"@commitlint/config-conventional"
|
|
77
|
-
]
|
|
74
|
+
],
|
|
75
|
+
"rules": {
|
|
76
|
+
"body-max-line-length": [
|
|
77
|
+
0
|
|
78
|
+
]
|
|
79
|
+
}
|
|
78
80
|
},
|
|
79
81
|
"nano-staged": {
|
|
80
82
|
"*.js": [
|
package/src/index.js
CHANGED
|
@@ -100,12 +100,16 @@ class Router extends Trouter {
|
|
|
100
100
|
const loop = () =>
|
|
101
101
|
res.writableEnded ||
|
|
102
102
|
(index < size &&
|
|
103
|
-
(() => {
|
|
103
|
+
(async () => {
|
|
104
104
|
try {
|
|
105
105
|
const mware = middlewares[index++]
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const result =
|
|
107
|
+
index === size
|
|
108
|
+
? mware(undefined, req, res, next)
|
|
109
|
+
: mware(req, res, next)
|
|
110
|
+
if (result && typeof result.then === 'function') {
|
|
111
|
+
await result
|
|
112
|
+
}
|
|
109
113
|
} catch (err) {
|
|
110
114
|
return this.unhandler(err, req, res, next)
|
|
111
115
|
}
|