Model View Controller (MVC) Pattern
The Model View Controller Architecture is the most used pattern for today’s world web applications. The MVC pattern separates an application in three parts: Model, View and Controller.

This is a software design pattern that distinguishes between the data underlying the software (the model), the way that data is displayed to the user (the view), and the decisions about what data to display when (the controller).
The model is responsible to manage the data. It stores and retrieves entities used by an application, from a database, and contains the logic implemented by the application.
The view (presentation) is responsible to display the data provided by the model in a specific format.
The controller handles the model and view layers to work together. The controller receives a request from the client, invokes the model to perform the requested operations and sends the data to the View. The view formats the data to be presented to the user, in a web application as an html output.
The controller is the first thing which takes a request, parses it, initialises and invoke the model and takes the model response and sends it to the presentation layer.
Example
First, the web client sends an HTTP request. Then, the controller (the main application logic) interprets the request and decides what to do. This may involve checking any stored security credentials and other data and deciding the appropriate actions to take in response to the received request.
Often the controller needs to get data from some source, like database, file, or API running on another server. This data is the model component of the MVC pattern. If the received request contains data submitted from a form, the controller may need to update or delete some of the model data.
Then the controller invokes the view component, such as a template file, to create the contents of the response to be returned to the user. The controller passes along data collected from the model when it invokes the view component.
Finally, the controller sends the response that it has created back to the web client (adding any appropriate headers, response codes).