Created
June 11, 2019 22:08
-
-
Save scottalan/4f179d4f8996575099535728d095d33a to your computer and use it in GitHub Desktop.
Serverless : Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This demonstrates how you can provide a custom template for the Content-Type. | |
# In this example this would be a POST of Content-Type: application/xml | |
functions: | |
parseXml: | |
handler: handler.parseXml | |
memorySize: 128 | |
events: | |
- http: | |
path: "/angler" | |
method: post | |
# https://github.com/serverless/serverless/blob/master/docs/providers/aws/events/apigateway.md#pass-through-behavior | |
# https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-method-settings-execution-console.html | |
integration: lambda | |
request: | |
passThrough: NEVER # NEVER, WHEN_NO_MATCH, WHEN_NO_TEMPLATES | |
# headers: | |
# Content-Type: "'application/xml'" | |
template: | |
application/xml: > | |
{ | |
"xml": "$input.body" | |
} | |
# response: | |
# headers: | |
# Content-Type: integration.response.header.Content-Type | |
cors: true | |
# This states that we require an api key for this function. | |
# Clients connecting to this REST Api will need to set the value of | |
# the API key in the x-api-key header of the request. | |
private: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment