8000 Added docs for the v0.2.0 release · aceew/lambda-proxy-router@b50bba3 · GitHub
[go: up one dir, main page]

Skip to content

Commit b50bba3

Browse files
committed
Added docs for the v0.2.0 release
1 parent 4254b08 commit b50bba3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ Create your endpoint in API Gateway for the Lambda function and check the `Use L
8080
## Routes
8181
Routes are used to match a request to a given handler and are easily defined by the route method on the instance of the router. The route method takes one object parameter which should contain 3 keys.
8282

83-
| Key | Type | Value |
84-
|---|---|---|---|
85-
| method | string/Array | The http method the route should match for. More than one can be specified |
86-
| path | string/Array | This should match the value of the route specified in API gateway including path parameter names |
87-
| [handler](#handler) | Function | The handler function for the given route. Should take two parameters of [request](#request) and [response](#response). |
83+
| Key | Type | Value
84+
|---|---|---|---
85+
| method | string/Array | The http method the route should match for. More than one can be specified
86+
| path | string/Array | This should match the value of the route specified in API gateway including path parameter names
87+
| [handler](#handler) | Function | The handler function for the given route. Should take two parameters of [request](#request) and [response](#response).
8888

8989
Before creating a route the router must be instanced. This is done like so:
9090

@@ -127,6 +127,7 @@ The response parameter is used to send a response back to API gateway. This meth
127127
| params.statusCode | integer | The HTTP status code | 200
128128
| params.headers | Object | Any headers to be returned in the response. | {}
129129
| params.body | mixed | Your response body, whatever is specified will be `JSON.stringify`'d. If body is not set the body will be defined as the params object. | `JSON.stringify(params)`
130+
| params.isBase64Encoded | boolean | This is usually used for serving binary data from an API. | false
130131

131132
Here is the recommended way to call the response method.
132133
```
@@ -137,6 +138,8 @@ response({
137138
});
138139
```
139140

141+
More information about the proxy response object can be found on the [AWS documentation](http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html).
142+
140143
If any of the correct parameters are not specified, default values of empty headers, statusCode 200, and a stringified value of whatever was sent in the parameter for the body are used to make the response valid.
141144

142145
So `response('hello world')` would work out as:

0 commit comments

Comments
 (0)
0