无服务器:如何使用无服务器库集成网关响应?

时间:2017-06-12 07:36:34

标签: amazon-web-services aws-api-gateway serverless-framework

如何使用无服务器框架集成网关响应?

我无法在serverless.com以及插件serverless-aws-documentation中找到文档

enter image description here

2 个答案:

答案 0 :(得分:0)

好问题。我相信你可以在s-function.json文件中这样做:

"endpoints": [
{
  "path": "/test",
  "method": "GET",
  "authorizationType": "none",
  "apiKeyRequired": false,
  "requestParameters": {},
  "requestTemplates": {},
  "responses": {
    "400": {
      "statusCode": "400"
    },
    "default": {
      "statusCode": "200",
      "responseParameters": {},
      "responseModels": {"text/html": "Empty"},
      "responseTemplates": {"text/html": "$input.json('$')"},
      "text/html": ""
    }
  }
}
]

来源:

https://github.com/serverless/serverless/issues/587 https://github.com/serverless/serverless/issues/463

答案 1 :(得分:0)

docker ps --filter "label=project=user-app" 的资源部分添加,如下所示

serverless.yml