Creating a project and organizing files
We can implement a microservice by placing the entire code inside a single file. However, that does not offer readability. So, instead, we will break down the code into logically related blocks and place them within relevant files. This will give us the advantage of quickly identifying the place of logic while troubleshooting any issues in the code. Well-organized code also enhances code readability.
To begin implementing the notes_api
microservice, we will create a project. Then, we will add a few files to make the code organized and readable.
Run the following command to create a new project named notes_api
:
v new notes_api
Once you have run the v new notes_api
command, you will be prompted to provide a description, the version number, and license information, which are optional. Then, you can hit Enter.
Rename the notes_api.v
file to main.v
. Add two new files within the project, namely, util.v
and note.v
. Our new notes_api
project...