The MVC pattern used by Express
The MVC model is an application architecture model allowing an application to be broken down into different parts: models, views, and the controller:
- Models correspond to the data manipulated by the application. In general, this is data from databases. Node.js is closely tied to the MongoDB database, which is explored in the next chapter.
- Views correspond to the visualization of data, for example, input forms and displayed lists. Each display corresponds to a view that will be in the
views
directory of the application. - The controller allows navigation between the different views, depending on the data. For this, we use routes (in fact, URLs) that indicate the processing to be performed. The
routes
directory describes the routes used by the application (and the processing performed for each of them).
We can therefore see that the MVC model makes it possible to separate the processing, the display, and the data. This split is widely...