I read this doc: https://serverless.com/framework/docs/providers/google/guide/services/
users/
serverless.yml # Contains 4 functions that do Users CRUD operations and the Users database
posts/
serverless.yml # Contains 4 functions that do Posts CRUD operations and the Posts database
comments/
serverless.yml # Contains 4 functions that do Comments CRUD operations and the Comments database
how can I combine these serverless.yml
files to single serverless.yml
file? Beside deploy each service, I can run serverless deploy
once to deploy all services too.
The service is simply the name of your project. Since Serverless lets us deploy a project in multiple stages (prod, dev, staging…), CloudFormation stacks will contain both the service name and the stage: app-prod , app-dev , etc.
Explanation: Serverless. yml will not take care of Business logic specification .
I am defining functions in individual serverless.yml files and include file reference under functions in the main serverless.yml file and it works for me, I am also naming individual yml files as posts-sls.yml, users-sls.yml etc.
# foo-functions.yml
getFoo:
handler: handler.foo
deleteFoo:
handler: handler.foo
# serverless.yml
---
functions:
- ${file(../foo-functions.yml)}
- ${file(../bar-functions.yml)}
Referenced here:
https://github.com/serverless/serverless/issues/4218 https://serverless.com/framework/docs/providers/aws/guide/functions/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With