Skip to content

Instantly share code, notes, and snippets.

@dksheffield
Created March 6, 2017 16:33
Show Gist options
  • Save dksheffield/8e4654a0143d386b68e7d8a991544cfc to your computer and use it in GitHub Desktop.
Save dksheffield/8e4654a0143d386b68e7d8a991544cfc to your computer and use it in GitHub Desktop.
Sample Serverless API
ContactUsFormApi:
Type: "AWS::Serverless::Api"
Properties:
StageName: prod
DefinitionBody:
swagger: '2.0'
info:
description: Contact Us API
version: 1.0.0
title:
Ref: AWS::StackName
# put the contact info for your development or API team
contact:
email: jeremiah.sheffield@gmail.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
schemes:
- https
paths:
/contactus:
post:
consumes:
- "application/json"
responses:
"200":
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Origin: "'*'"
uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${SendContactUsMessageFunction.Arn}/invocations
passthroughBehavior: "when_no_match"
httpMethod: "POST"
contentHandling: "CONVERT_TO_TEXT"
type: "aws_proxy"
options:
consumes:
- "application/json"
produces:
- "application/json"
responses:
"200":
description: "200 response"
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Headers:
type: "string"
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'POST,OPTIONS'"
method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
method.response.header.Access-Control-Allow-Origin: "'*'"
requestTemplates:
application/json: "{\"statusCode\": 200}"
passthroughBehavior: "when_no_match"
type: "mock"
# Added by API Auto Mocking Plugin
host: virtserver.swaggerhub.com
basePath: /dksheffield/ContactUsForm/1.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment