问题描述
我想添加“hello 端点”,它响应诸如版本/可用端点之类的常量元数据。
在这种情况下,有没有办法在 template.yml 中内联配置 API 网关? 或者我应该编写像这样返回恒定响应的 lambda 吗?
helloLambda:
Type: AWS::Serverless::Function
Properties:
CodeUri: .....
Handler: .....
Description: this lambda returns constant data
Events:
Api:
Type: Api
Properties:
Path: /hello
Method: GET
解决方法
您可以考虑在 API Gateway 中进行模拟集成。 请参考链接: creating-an-amazon-api-gateway-with-a-mock-integration-using-cloudformation
美好的一天!