Organize the Backend Repo
Let’s make a couple of quick changes to our project before we get started.
Remove Unused Files
We have a couple of files as a part of the starter project that we can now remove.
$ rm handler.js
$ rm tests/handler.test.js
Update the serverless.yml
We are going to use a different service name.
Open the serverless.yml
and find the following line:
service: notes-app-api
And replace it with this:
service: notes-app-2-api
The reason we are doing this is because Serverless Framework uses the service
name to identify projects. Since we are creating a new project we want to ensure that we use a different name from the original. Now we could have simply overwritten the existing project but the resources were previously created by hand and will conflict when we try to create them through code.
Also, find this line in the serverless.yml
:
stage: prod
And replace it with:
stage: dev
We are defaulting the stage to dev
instead of prod
. This will become clear later when we create multiple environments.
Let’s quickly commit these changes.
$ git add .
$ git commit -m "Organizing project"
Next let’s look into configuring our entire notes app backend via our serverless.yml
. This is commonly known as Infrastructure as code.
For help and discussion
Comments on this chapterIf you liked this post, please subscribe to our newsletter, give us a star on GitHub, and follow us on Twitter.