Express doesn't follow a pure model-view-controller (MVC) structure, but the blank application created by the express
command line tool provides you with two MVC aspects. These are stated as follows:
This leaves one wondering how to handle code implementing the model. The role of the model is to hold the application data, changing the data as instructed by the controller, and supplying the data requested by the view.
At a minimum, the model code should be in a separate module from the controller code. That's because, ideally, the model and controller code should be as independent from each other as possible.
The approach we'll use in developing the Notes application is to create a models
directory as a sibling of views
and routes
. The...