Skip to content

Commit 462b6ff

Browse files
author
jzlai
committed
fix some typing
1 parent d5b43aa commit 462b6ff

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,32 @@ A small library for [AWS Lambda](https://aws.amazon.com/lambda/details) providin
1212
* Easy Handling of [ANY method](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-settings-method-request.html#setup-method-add-http-method) in API Gateways
1313
* Simplifies writing lambda handlers (in nodejs)
1414
* Lambda Proxy Resource support for AWS API Gateway
15-
* Enable CORS for the requests
16-
* No dependencies
17-
* Currently there are two `processors` (caller for Lambda) implemented: API Gateway ANY method (called proxyIntegration) and SNS.
15+
* Enable CORS for requests
16+
* No external dependencies
17+
* Currently there are two `processors` (callers for Lambda) implemented: API Gateway ANY method (called proxyIntegration) and SNS.
1818

1919
## Installation
20-
Install via npm.
20+
Install via npm
2121

2222
```
2323
$ npm install aws-lambda-router
2424
```
25+
or yarn
26+
27+
```
28+
$ yarn install aws-lambda-router
29+
```
2530

2631
## Getting Started
2732

28-
This is an simple using of `aws-lambda-router` in connection with ANY method and the API Gateway proxy Intergration. The following code will response with a message when executed using the AWS API Gateway with a `GET` request of URL path `<base-url-of-gateway/gateway-mapping/article/123`.
33+
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`.
2934

3035
```js
3136
const router = require('aws-lambda-router');
3237

3338
// handler for an api gateway event
3439
exports.handler = router.handler({
35-
// for handling an http-call from an AWS Apigateway proxyIntegration we provide the following config:
40+
// for handling an http-call from an AWS API Gateway proxyIntegration we provide the following config:
3641
proxyIntegration: {
3742
routes: [
3843
{
@@ -52,7 +57,7 @@ exports.handler = router.handler({
5257
5358
## Enable CORS
5459
55-
To activate CORS on all http methods (OPTIONS requests are handled automatically) you only sets the parameter `cors` to `true` of the `proxyIntegration` rule.
60+
To activate CORS on all http methods (OPTIONS requests are handled automatically) you only need to set the parameter `cors` to `true` on the `proxyIntegration` rule.
5661
5762
See the following example:
5863
@@ -68,7 +73,7 @@ exports.handler = router.handler({
6873
{
6974
path: '/graphql',
7075
method: 'POST',
71-
// provide a function to be called with the propriate data
76+
// provide a function to be called with the appropriate data
7277
action: (request, context) => doAnything(request.body)
7378
}
7479
]
@@ -138,24 +143,24 @@ exports.handler = router.handler({
138143
139144
### Custom response
140145
141-
Per default a status code 200 will be returned. This behavior can be override.
146+
Per default a status code 200 will be returned. This behavior can be overridden.
142147
143-
By providing body in the returned object you can modify statuscode and response headers.
148+
By providing a body property in the returned object you can modify the status code and response headers.
144149
145150
```js
146151
return {
147152
// Allow for custom status codes depending on execution.
148153
statusCode: 218,
149-
// Headers will merge with CORs headers when enabled.
154+
// Headers will merge with CORS headers when enabled.
150155
// Will merge with Content-Type: application/json
151156
headers: {
152157
'x-new-header': 'another-value'
153158
},
154-
// When returning a custom response object, a key of body is required
159+
// When returning a custom response object, a key of body is required
155160
// The value of body needs to be JSON stringified, this matches
156161
// the expected response for an AWS Lambda.
157162
body: JSON.stringify({
158-
foo:'bar'
163+
foo: 'bar'
159164
})
160165
};
161166
```

0 commit comments

Comments
 (0)