当serverless.yml的api规范是用resources而不是functions格式描述时,就不能在本地执行。
resources的swagger格式描述的。serverless.yml在下面。
functions:
test:
handler: test.test
resources:
Resources:
RestApi :
Type : AWS::ApiGateway::RestApi
Properties :
Body : ${file(./swagger.yaml)}sls offline的结果没有用于测试API的路由。
Serverless: Starting Offline: dev/ap-northeast-1.
Serverless: Routes for test:
Serverless: (none)
Serverless: Offline listening on http://localhost:3000functions serverless.yml中的swagger格式描述如下。functions:
test:
handler: test.test
events:
- http: GET test
#resources:
# Resources:
# RestApi :
# Type : AWS::ApiGateway::RestApi
# Properties :
# Body : ${file(./swagger.yaml)}sls offline的结果有测试API的路径。
Serverless: Starting Offline: dev/ap-northeast-1.
Serverless: Routes for test:
Serverless: GET /test
Serverless: Offline listening on http://localhost:3000我希望通过在资源中以swagger格式描述规范来在本地运行API。有办法做到这一点吗?
发布于 2019-03-05 23:48:55
serverless-offline插件理解无服务器环境,但不了解自定义AWS资源。未来它也不太可能成为一个抽象层,因为它是一个无服务器的层。
也许阿姆斯-山姆-克里更适合您的应用程序。它似乎支持昂首阔步的文档和本地环境。
https://stackoverflow.com/questions/54996261
复制相似问题