Full-Stack Web Development with Vue.js and Node

(singke) #1
Building an Express Application Chapter 2

To run the server, use the following command:


$ nodemon app.js

File naming conventions


When developing an application, we need to follow a certain convention to name the files.
As we go on building the application, we will have a whole lot of files, which can get


messy. MVC allows for having parallel naming conventions across different folders, which
can lead to the same filenames inside different folders.


We can work on such filenames as well if that is what we find to be easy and maintainable.


Otherwise, we can just append the type of filename to each file, as in the following
example; for a controller file to handle the user-related activities, we can leave it


as controllers/users.js, or we can rename it


to controllers/users_controller.js. We will be using controllers/users for our


application.


The same goes for models, services, or any other folders that need to be shared among


different areas throughout the application. For this application, we will be using the


following naming convention:

Free download pdf