Over the last 30 years, websites have gone from simple HTML pages with a bit of CSS to incredibly complex applications with thousands of developers working on them. To decrease the complexity of the project, developers started to use different software Architectural design patterns. Yes! Amongst them, MVC Architecture is the most popular pattern. MVC stands for Model, View, and Controller. Each of these components is built to handle specific development aspects of an application.
At first, the client will send the request to the server. When the request comes to the server, the Controller will respond to the request. The controller is responsible for handling request flow.
Next, the Controller will pass the request to the Model. Model is responsible for handling data logic and interactions with the database. Model gets the data for the particular request from the database and sends it back to Controller.
The controller cannot send data directly to the client. Because the data might not be in a human-readable format. Here, Controller sends the data to be modified to View. The view is responsible for handling data presentation and dynamical rendering. View format the data, arrange it, add some styles, and pass it back to Controller. The controller gives the data to the client as a response.
For example, the user sends the request to the server to get the list of employees. The controller will take the request and send it to the model. Model query the database via select * from Employee and return the list of employees to Controller. On successful retrieval of data from the model to the controller, the Controller sends the list to View to get the presentation. View renders the list in HTML format and returns to Controller. Finally, Controller gives the list of employees to the user as a response.
Popular MVC web frameworks
3) Express JS
5) Ruby on Rails