What Is MVC?

MVC is a design pattern that breaks an application into three parts: the data (Model), the presentation layer (View), and the user interaction layer (Controller). In other words, the event flow goes like this:
mvc
1.The user interacts with the application.
2.The controller’s event handlers trigger.
3.The controller requests data from the model, giving it to the view.
4.The view presents the data to the user.

Lets have an example of login in facebook:
Suppose login form is the view, when user enters the details in the form and hits enter, the controller will use the model to collect the data and will send the request to read and compare from the database. If the user exists and the credentials are correct then the controller will set the authorization cookie to true, so that the user status will change to logged in and he can do the actions on the site as logged in user.

Memo : View is for front end, Controller is for logics and Model for data.

More On this : MVC

About

My Name is Dileep Singh, Noder, Javascript Lover & NoSql Developer, Fitness Freak, Love to travel new places, learning photography & Music Manic ♯ ♩ ♬

Posted in Javascript, Node.Js Tagged with: ,