Interface: ApiGatewayHandlerConfig<RequestT>
lambda.ApiGatewayHandlerConfig
Configuration for an API Gateway Lambda handler.
Type parameters
Name |
---|
RequestT |
Properties
allowHeaders
• Optional
allowHeaders: string
[]
Sets Access-Control-Allow-Headers
to include the listed headers.
coerceTypes
• Optional
coerceTypes: boolean
If schema validation should attempt to coerce the parsed types of the request. Defaults to
false
.
cors
• cors: boolean
Sets Access-Control-Allow-Origin
header to *
if enabled. Required for CORS support.
errorHandler
• Optional
errorHandler: (error
: any
) => Promise
<APIGatewayProxyResult
>
Error response builder.
Type declaration
▸ (error
): Promise
<APIGatewayProxyResult
>
Parameters
Name | Type |
---|---|
error |
any |
Returns
Promise
<APIGatewayProxyResult
>
handler
• handler: ApiGatewayHandlerCallback
<RequestT
>
Callback for the Lambda logic.
https
• https: boolean
Sets Access-Control-Allow-Credentials
header to true
if enabled. Required for cookies
and authorization headers with HTTPS.
otherContentTypeHandler
• Optional
otherContentTypeHandler: (body
: string
) => any
Optional handler to produce a request data object from the raw event body. This will be invoked in the case where none of the built-in handlers were able to process the content.
Type declaration
▸ (body
): any
Parameters
Name | Type |
---|---|
body |
string |
Returns
any
schema
• Optional
schema: any
Optional schema to enable automatic schema validation: failed schema validation will result
in a status: 'error'
response with the schema validation error in the message
field.