post:
responses:
"200":
description: 200 response
headers:
Access-Control-Allow-Origin:
type: string
x-amazon-apigateway-integration:
uri:
Fn::Sub: "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${BookCreate.Arn}/invocations"
responses:
default:
statusCode: 200
responseParameters:
method.response.header.Access-Control-Allow-Origin: "'*'"
passthroughBehavior: when_no_match
httpMethod: POST #always POST
type: aws_proxy
Events:
CreateBook:
Type: Api
Properties:
Path: /books/
Method: post
RestApiId:
Ref: BookApi
Run the following command to deploy SAM
sam build
sam deploy --guided
Enter “y” if asked “BookCreate may not have authorization defined, Is this okay? [y/N]:”
Open book_create function console
Show API Gateway being interacted with this function
Display the resources and POST method
Click Stages on the left menu