Our project structure

Let's start by creating the Project structure for our source code. Create the following directories and files in your working directory, as shown in the following screenshot:

The src folder contains three subfolders: models, routes, and config. In this chapter, we will just use the routes folder and the teams-api.js file. The other two will be explored in the next chapter when we talk about Databases and MongoDB.

The goal of the routes folder is to host all the API Routes declaration. We have declared our routes in the server.js file; it might be a good idea if we are working on a small project, but it is not a good idea for a big project, which will have a lot of routes declarations. For that reason, a good strategy is to separate the routes per API functionality; for example, teams-API, matches-API, and auth-API. With this, we will have more easy-to-read and easy-to-maintain code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset