Wiring handler.py to Lambda via API Gateway

Next, we need to wire up our API endpoints to Lambda and our handler.py entry point. This wiring looks like this in a serverless.yml configuration file:

functions:  HandleSession:    handler: handler.session    events:      - http:          path: session          method: get          cors: true      - http:          path: session          method: post          cors: true  HandleSessionDetail:    handler: handler.session_detail    events:      - http:          path: session/{id}          method: get          cors: true          request:            parameters:              paths:                id: true      - http:          path: session/{id}          method: delete          cors: true          request:            parameters:              paths:                id: true

We define two Lambda functions that have different configuration options, HandleSession and HandleSessionDetail.

Under each function's name, there are multiple statements ...

Get Serverless Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.