Skip to content

Commit 122f538

Browse files
authored
Update README.md
1 parent 24200df commit 122f538

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,28 @@ A wrap around response for aws lambda integration proxy
88

99
## Response creation
1010
1. Response can be created using `response` method
11-
```
12-
var lambdaProxy = require('lambda-proxy-reponse');
13-
14-
exports.handler = (event, context, callback) => {
15-
// response method needs at least 3 parameters
16-
// statusCode, headers, body
17-
var response = lambdaProxy.response(200, { 'X-header': 'Your headers value' }, { 'bodyData': 'yourBodyData });
18-
19-
// -> response = {
20-
// statusCodes: 200,
21-
// headers: {'X-header': 'Your headers value'},
22-
// body: '{ "bodyData": "yourBodyData" }'
23-
// }
24-
callback(null, response);
25-
26-
27-
// OR you can pass the callback to the `response` method and it will be called automatically
28-
// The above implementation equal to
29-
lambdaProxy.response(200, { 'X-header': 'Your headers value' }, { 'bodyData': 'yourBodyData }, callback);
30-
};
31-
```
11+
```
12+
var lambdaProxy = require('lambda-proxy-reponse');
13+
14+
exports.handler = (event, context, callback) => {
15+
// response method needs at least 3 parameters
16+
// statusCode, headers, body
17+
var response = lambdaProxy.response(200, { 'X-header': 'Your headers value' }, { 'bodyData': 'yourBodyData });
18+
19+
// -> response = {
20+
// statusCodes: 200,
21+
// headers: {'X-header': 'Your headers value'},
22+
// body: '{ "bodyData": "yourBodyData" }'
23+
// }
24+
callback(null, response);
25+
26+
27+
// OR you can pass the callback to the `response` method and it will be called automatically
28+
// The above implementation equal to
29+
lambdaProxy.response(200, { 'X-header': 'Your headers value' }, { 'bodyData': 'yourBodyData }, callback);
30+
};
31+
```
32+
3233
2. Some others shorthand method, useful for common http status
3334
- `lambdaProxy.ok = lambdaProxy.response(200, ...)`
3435
- `lambdaProxy.created = lambdaProxy.response(201, ...)`

0 commit comments

Comments
 (0)