- Serverless Design Patterns and Best Practices
- Brian Zambrano
- 128字
- 2021-08-27 19:12:04
Function layout
In our example, we will implement a pattern where a single Lambda function will handle a single grouping of URL endpoints. The initial set of endpoints that we will implement will be the following:
- List coffee cupping sessions: GET /session
- Create a coffee cupping session: POST /session
- Get coffee cupping session details: GET /session/{id}
- Delete a coffee cupping session: DELETE /session/{id}
Two unique URLs will map to two Lambda functions. These lambda functions will be responsible for inspecting the HTTP request passed in from API Gateway, determining what HTTP method is being called, and invoking the appropriate application code to fulfill the request:

Request routing for a /session endpoint. The application code will inspect the HTTP method and route to the appropriate application code for execution.
推薦閱讀