You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,10 +36,9 @@ $ yarn add aws-lambda-router
36
36
This is a simple example of `aws-lambda-router` in conjunction with ANY method and the API Gateway proxy integration. The following code will respond with a message when executed using an AWS API Gateway with a `GET` request on URL path `<base-url-of-gateway>/gateway-mapping/article/123`.
37
37
38
38
```js
39
-
constrouter=require('aws-lambda-router');
39
+
import*asrouterfrom'aws-lambda-router'
40
40
41
-
// handler for an api gateway event
42
-
exports.handler=router.handler({
41
+
exportconsthandler=router.handler({
43
42
// for handling an http-call from an AWS API Gateway proxyIntegration we provide the following config:
44
43
proxyIntegration: {
45
44
routes: [
@@ -66,9 +65,9 @@ See the following example:
66
65
67
66
68
67
```js
69
-
constrouter=require('aws-lambda-router');
68
+
import*asrouterfrom'aws-lambda-router'
70
69
71
-
exports.handler=router.handler({
70
+
exportconsthandler=router.handler({
72
71
// for handling an http-call from an AWS Apigateway proxyIntegration we provide the following config:
73
72
proxyIntegration: {
74
73
cors:true,
@@ -94,9 +93,9 @@ If CORS is activated, these default headers will be sent on every response:
94
93
## Errormapping
95
94
96
95
```js
97
-
constrouter=require('aws-lambda-router');
96
+
import*asrouterfrom'aws-lambda-router'
98
97
99
-
exports.handler=router.handler({
98
+
exportconsthandler=router.handler({
100
99
// for handling an http-call from an AWS Apigateway proxyIntegration we provide the following config:
For handling calls in Lambdas initiated from AWS-SQS you can use the following code snippet:
157
156
158
157
```js
159
-
constrouter=require('aws-lambda-router');
158
+
import*asrouterfrom'aws-lambda-router'
160
159
161
-
exports.handler=router.handler({
160
+
exportconsthandler=router.handler({
162
161
sqs: {
163
162
routes: [
164
163
{
@@ -200,9 +199,9 @@ The action method will be called with the records of the [S3Event Structure](htt
200
199
The following examples demonstrates the most use cases:
201
200
202
201
```js
203
-
constrouter=require('aws-lambda-router');
202
+
import*asrouterfrom'aws-lambda-router'
204
203
205
-
exports.handler=router.handler({
204
+
exportconsthandler=router.handler({
206
205
s3: {
207
206
routes: [
208
207
{
@@ -290,6 +289,7 @@ See here: https://yarnpkg.com/en/docs/cli/link
290
289
291
290
## Release History
292
291
292
+
* 0.7.0 migrate to typescript; using aws-lambda typings; proxyIntegration: cors is now optional (default: false);
293
293
* 0.6.2 take away old gulp dependency to run tests, works now with scripts in package.json; normalize request path to start from local host (thanks to [@napicella](https://github.com/napicella))
294
294
* 0.6.1 s3: fix: aggregate result promises to one promise; fix: s3Route interface
0 commit comments