@middy/http-router 3.0.0-alpha.2 → 3.0.0-alpha.6
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 +2 -2
- package/index.js +2 -2
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -42,8 +42,8 @@ npm install --save @middy/http-router
|
|
|
42
42
|
- `handler` (function) (required): Any `handler(event, context)` function
|
|
43
43
|
|
|
44
44
|
NOTES:
|
|
45
|
-
- Errors should be handled as part of the router middleware stack **or** the
|
|
46
|
-
- Shared middlewares, connected to the router middleware stack, can only be run before the
|
|
45
|
+
- Errors should be handled as part of the router middleware stack **or** the lambdaHandler middleware stack. Handled errors in the later will trigger the `after` middleware stack of the former.
|
|
46
|
+
- Shared middlewares, connected to the router middleware stack, can only be run before the lambdaHandler middleware stack.
|
|
47
47
|
|
|
48
48
|
## Sample usage
|
|
49
49
|
|
package/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const httpRouteHandler = routes => {
|
|
|
13
13
|
} = route;
|
|
14
14
|
|
|
15
15
|
if (!enumMethods.includes(method)) {
|
|
16
|
-
throw new Error('
|
|
16
|
+
throw new Error('[http-router] Method not allowed');
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
if (path.endsWith('/') && path !== '/') {
|
|
@@ -37,7 +37,7 @@ const httpRouteHandler = routes => {
|
|
|
37
37
|
} = (_getVersionRoute = getVersionRoute[event.version ?? '1.0']) === null || _getVersionRoute === void 0 ? void 0 : _getVersionRoute.call(getVersionRoute, event);
|
|
38
38
|
|
|
39
39
|
if (!method) {
|
|
40
|
-
throw new Error('Unknown
|
|
40
|
+
throw new Error('[http-router] Unknown http event format');
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const handler = (_routesStatic$method = routesStatic[method]) === null || _routesStatic$method === void 0 ? void 0 : _routesStatic$method[path];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-router",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.6",
|
|
4
4
|
"description": "http event router for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"test": "npm run test:unit",
|
|
21
|
-
"test:unit": "ava"
|
|
21
|
+
"test:unit": "ava",
|
|
22
|
+
"test:benchmark": "node __benchmarks__/index.js"
|
|
22
23
|
},
|
|
23
24
|
"license": "MIT",
|
|
24
25
|
"keywords": [
|
|
@@ -48,10 +49,10 @@
|
|
|
48
49
|
},
|
|
49
50
|
"homepage": "https://github.com/middyjs/middy#readme",
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@middy/util": "^3.0.0-alpha.
|
|
52
|
+
"@middy/util": "^3.0.0-alpha.6"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@middy/core": "^3.0.0-alpha.
|
|
55
|
+
"@middy/core": "^3.0.0-alpha.6"
|
|
55
56
|
},
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "176660ed3e0716d6bfb635c77251b301e0e24720"
|
|
57
58
|
}
|