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
* AWS [Lambda function URLs](https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html)
17
17
18
-
Thanks to the Request type we can seemsly handle proxy integrations without the worry to specify the specific service type.
18
+
Thanks to the `Request` type we can seamlessly handle proxy integrations without the worry to specify the specific service type.
19
19
20
-
There is also an Extentions for `lambda_http::Request` structs that provide access to [API gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format) and [ALB](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html) features.
20
+
There is also an extension for `lambda_http::Request` structs that provide access to [API gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format) and [ALB](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html) features.
21
21
22
22
For example some handy extensions:
23
23
24
-
* query_string_parameters - Return pre-parsed http query string parameters, parameters provided after the `?` portion of a url associated with the request
25
-
* path_parameters - Return pre-extracted path parameters, parameter provided in url placeholders `/foo/{bar}/baz/{boom}` associated with the request
26
-
* payload - Return the Result of a payload parsed into a serde Deserializeable type
24
+
*`query_string_parameters` - Return pre-parsed http query string parameters, parameters provided after the `?` portion of a url associated with the request
25
+
*`path_parameters` - Return pre-extracted path parameters, parameter provided in url placeholders `/foo/{bar}/baz/{qux}` associated with the request
26
+
*`lambda_context` - Return the Lambda context for the invocation; see the [runtime docs](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html#runtimes-api-next)
27
+
*`request_context` - Return the ALB/API Gateway request context
28
+
* payload - Return the Result of a payload parsed into a type that implements `serde::Deserialize`
29
+
30
+
See the `lambda_http::RequestPayloadExt` and `lambda_http::RequestExt` traits for more extensions.
27
31
28
32
## Examples
29
33
30
-
Here you will find a few examples to handle basic scenarions:
34
+
Here you will find a few examples to handle basic scenarios:
31
35
32
-
* Reading a JSON from a body and deserialise into a structure
33
-
* Reading querystring parameters
36
+
* Reading a JSON from a body and deserialize into a structure
37
+
* Reading query string parameters
34
38
* Lambda Request Authorizer
35
-
* Passing the Lambda execution context initialisation to the handler
39
+
* Passing the Lambda execution context initialization to the handler
36
40
37
-
### Reading a JSON from a body and deserialise into a structure
41
+
### Reading a JSON from a body and deserialize into a structure
38
42
39
43
The code below creates a simple API Gateway proxy (HTTP, REST) that accept in input a JSON payload.
## Passing the Lambda execution context initialisation to the handler
181
+
## Passing the Lambda execution context initialization to the handler
180
182
181
183
One of the [best practices](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html) is to take advantage of execution environment reuse to improve the performance of your function. Initialize SDK clients and database connections outside the function handler. Subsequent invocations processed by the same instance of your function can reuse these resources. This saves cost by reducing function run time.
0 commit comments