Implementing the MVC pattern

The Express framework is pattern-agnostic, which means that it doesn't support any predefined syntax or structure, as some other web frameworks do. Applying the MVC pattern to your Express application means that you can create specific folders where you place your JavaScript files in a certain logical order. All these files are basically CommonJS modules that function as logical units. For instance, models will be CommonJS modules that contain a definition of Mongoose models placed in the models folder, views will be HTML or other template files placed in the views folder, and controllers will be CommonJS modules with functional methods placed in the controllers folder. To illustrate this better, it's time to discuss ...

Get MEAN Web Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.