@@ -26,7 +26,7 @@ exports.handler = router.handler(
2626 // activate CORS on all http-methods (OPTIONS requests are handled automagically);
2727 // if set to true, these default headers will be sent on every response:
2828 // "Access-Control-Allow-Origin" = "'*'"
29- // "Access-Control-Allow-Methods" = "'GET,POST,PUT,DELETE,HEAD'"
29+ // "Access-Control-Allow-Methods" = "'GET,POST,PUT,DELETE,HEAD,PATCH '"
3030 // "Access-Control-Allow-Headers" = "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
3131 cors: true ,
3232 routes: [
@@ -36,19 +36,19 @@ exports.handler = router.handler(
3636 // http method to match
3737 method: ' POST' ,
3838 // provide a function to be called with the propriate data
39- action : request => doAnything (request .body )
39+ action : ( request , context ) => doAnything (request .body )
4040 },
4141 {
4242 // request-path-pattern with a path variable:
4343 path: ' /article/:id' ,
4444 method: ' GET' ,
4545 // we can use the path param 'id' in the action call:
46- action : request => getSomething (request .paths .id )
46+ action : ( request , context ) => getSomething (request .paths .id )
4747 },
4848 {
4949 path: ' /:id' ,
5050 method: ' DELETE' ,
51- action : request => deleteSomething (request .paths .id )
51+ action : ( request , context ) => deleteSomething (request .paths .id )
5252 }
5353 ],
5454 debug: true ,
@@ -68,7 +68,7 @@ exports.handler = router.handler(
6868 // a regex to match the content of the SNS-Subject:
6969 subject: / . * / ,
7070 // Attention: the message is JSON-stringified
71- action : sns => service .doSomething (JSON .parse (sns .Message ))
71+ action : ( sns , context ) => service .doSomething (JSON .parse (sns .Message ))
7272 }
7373 ]
7474 }
@@ -101,13 +101,14 @@ return {
101101
102102## local developement
103103
104- The best is to work with ``` npm link```
104+ The best is to work with ``` yarn link```
105105
106- See here: http ://vansande.org/2015/03/20/npm- link/
106+ See here: https ://yarnpkg.com/en/docs/cli/ link
107107
108108
109109## Release History
110110
111+ * 0.4.0 now [ the Context Object] ( https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html ) pass through
111112* 0.3.1 proxyIntegration: avoid error if response object is not set; add some debug logging
112113* 0.3.0 proxyIntegration: add PATCH method; allow for custom status codes from route (thanks to [ @mintuz ] ( https://github.com/mintuz ) )
113114* 0.2.2 proxyIntegration: set correct header values now for CORS
0 commit comments