REST API with Express.js

The name MVC comes from the Words: Model, View and Controller. The idea of MVC framework is to split up the the business logic, database access and presentation. So it makes your application to modular.

MVC Architecture

MVC Pattern stands for Model-View-Controller Pattern. The Model-View-Controller (MVC) pattern is an architectural design principle that separates the application components of a Web application into three layers. This separation gives you more control over the individual parts of the application, which lets you more easily develop, modify, and test them.

Model contains and exposes the properties and application logic In a better way we can say that The model represents core business logic and data. The data can be retrieved from a database. So if there is a database, the Model is the one that will communicate with the database.
The View is responsible for creating the response HTML or any responses back to the browser like pdf, html etc. In other way we can say that the view is responsible for transforming a model or models into a visual representation.
Controller is responsible for processing user inputs from view and give responses back to the view. It means that the controller decides the action and performs the tasks/logic based on the parameters. Controller acts as the coordinator between the view and the model.
How does it work?

The controllers makes the most of the work. It asks the data from the model and sends it to the view. The view is the one that the user sees. So in web applications the html code is in the views. And when the user clicks some buttons or writes the url in the browser, they will call the controllers.

Toggle Menu