在玩了很多次之后,我相信我在一个例子中找到了答案。
here
. 与Sam为您开箱即用设置的Hello World示例相关的差异是:
diff --git a/sam-app/template.yaml b/sam-app/template.yaml
index 02cd901..f349dcc 100644
--- a/sam-app/template.yaml
+++ b/sam-app/template.yaml
@@ -17,11 +17,11 @@ Resources:
Variables:
PARAM1: VALUE
Events:
- HelloWorld:
+ ProxyApiGreedy:
Type: Api
Properties:
- Path: /hello
- Method: get
+ Path: /{proxy+}
+ Method: ANY
Outputs:
HelloWorldApi:
Description: API Gateway endpoint URL for Prod stage for Hello World function
换句话说,就像这样:
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
...
Events:
ProxyApiGreedy:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY