@middy/http-router 4.0.0 → 4.0.2

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.
Files changed (2) hide show
  1. package/README.md +0 -74
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -36,80 +36,6 @@
36
36
  <p>You can read the documentation at: <a href="https://middy.js.org/docs/routers/http-router">https://middy.js.org/docs/routers/http-router</a></p>
37
37
  </div>
38
38
 
39
- This handler can route to requests to one of a nested hander based on `method` and `path` of an http event from API Gateway (REST or HTTP) or Elastic Load Balancer.
40
-
41
- ## Install
42
-
43
- To install this middleware you can use NPM:
44
-
45
- ```bash
46
- npm install --save @middy/http-router
47
- ```
48
-
49
- ## Options
50
- - `routes` (array[{method, path, handler}]) (required): Array of route objects.
51
- - `method` (string) (required): One of `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS` and `ANY` that will match to any method passed in
52
- - `path` (string) (required): AWS formatted path starting with `/`. Variable: `/{id}/`, Wildcard: `/{proxy+}`
53
- - `handler` (function) (required): Any `handler(event, context)` function
54
-
55
- NOTES:
56
- - 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.
57
- - Shared middlewares, connected to the router middleware stack, can only be run before the lambdaHandler middleware stack.
58
-
59
- ## Sample usage
60
-
61
- ```javascript
62
- import middy from '@middy/core'
63
- import validatorMiddleware from '@middy/validator'
64
-
65
- const getHandler = middy()
66
- .use(validatorMiddleware({eventSchema: {...} }))
67
- .handler((event, context) => {
68
- return {
69
- statusCode: 200,
70
- body: '{...}'
71
- }
72
- })
73
-
74
- const postHandler = middy()
75
- .use(validatorMiddleware({eventSchema: {...} }))
76
- .handler((event, context) => {
77
- return {
78
- statusCode: 200,
79
- body: '{...}'
80
- }
81
- })
82
-
83
- handler = middy()
84
- .use(httpHeaderNormalizer())
85
- .handler(httpRouterHandler([
86
- {
87
- method: 'GET',
88
- path: '/user/{id}',
89
- handler: getHandler
90
- },
91
- {
92
- method: 'POST',
93
- path: '/user',
94
- handler: postHandler
95
- }
96
- ]))
97
-
98
-
99
- module.exports = { handler }
100
- ```
101
-
102
-
103
- ## Middy documentation and examples
104
-
105
- For more documentation and examples, refers to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org).
106
-
107
-
108
- ## Contributing
109
-
110
- Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
111
-
112
-
113
39
  ## License
114
40
 
115
41
  Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-router",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "HTTP event router for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -62,11 +62,11 @@
62
62
  },
63
63
  "homepage": "https://middy.js.org",
64
64
  "dependencies": {
65
- "@middy/util": "4.0.0"
65
+ "@middy/util": "4.0.2"
66
66
  },
67
67
  "devDependencies": {
68
- "@middy/core": "4.0.0",
68
+ "@middy/core": "4.0.2",
69
69
  "@types/aws-lambda": "^8.10.97"
70
70
  },
71
- "gitHead": "582286144bcd79968a8c7c2f8867a23c80079a47"
71
+ "gitHead": "c77c9413ecb80999a71b67ff97edac1fed2ca754"
72
72
  }