Serverless framework 无法在无服务器框架上本地执行Swagger定义的API
当serverless.yml的api规范在Serverless framework 无法在无服务器框架上本地执行Swagger定义的API,serverless-framework,serverless,Serverless Framework,Serverless,当serverless.yml的api规范在资源而不是函数中以大摇大摆的格式描述时,api不能在本地执行 serverless.yml的API规范在resources serverless.yml在下面 functions: te
资源
而不是函数
中以大摇大摆的格式描述时,api不能在本地执行
resources
functions:
test:
handler: test.test
resources:
Resources:
RestApi :
Type : AWS::ApiGateway::RestApi
Properties :
Body : ${file(./swagger.yaml)}
sls离线的结果
没有测试API的路由
Serverless: Starting Offline: dev/ap-northeast-1.
Serverless: Routes for test:
Serverless: (none)
Serverless: Offline listening on http://localhost:3000
Serverless: Starting Offline: dev/ap-northeast-1.
Serverless: Routes for test:
Serverless: GET /test
Serverless: Offline listening on http://localhost:3000
functions
serverless.yml在下面sls离线的结果具有测试API的路由
Serverless: Starting Offline: dev/ap-northeast-1.
Serverless: Routes for test:
Serverless: (none)
Serverless: Offline listening on http://localhost:3000
Serverless: Starting Offline: dev/ap-northeast-1.
Serverless: Routes for test:
Serverless: GET /test
Serverless: Offline listening on http://localhost:3000
我希望通过在参考资料中以炫耀的格式描述规范,在本地运行API。有没有办法做到这一点?无服务器离线
插件了解无服务器环境,但不了解自定义AWS资源。由于无服务器是一个抽象层,它在未来也不太可能实现
也许更适合你的申请。它似乎支持招摇文档和本地环境。感谢您的回复!我将在下一个项目中尝试AWS SAM!