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
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -80,11 +80,11 @@ Create your endpoint in API Gateway for the Lambda function and check the `Use L
80
80
## Routes
81
81
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.
82
82
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).
88
88
89
89
Before creating a route the router must be instanced. This is done like so:
90
90
@@ -127,6 +127,7 @@ The response parameter is used to send a response back to API gateway. This meth
127
127
| params.statusCode | integer | The HTTP status code | 200
128
128
| params.headers | Object | Any headers to be returned in the response. | {}
129
129
| 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
130
131
131
132
Here is the recommended way to call the response method.
132
133
```
@@ -137,6 +138,8 @@ response({
137
138
});
138
139
```
139
140
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
+
140
143
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.
0 commit comments