Welcome to brand new section and that is MVC Design Party.
What is it and why should we care about it?
Well, let's explain more.
When we see MVC, it is a design pattern.
What does it mean?
Well, as a back end developer or as a programmer, you need a design pattern.
Simply means that how you write your code, because we have a standard way of writing code.
So the most popular design pattern in Node.js is what we call the MVC.
We have many types of design pattern, but in Node.js, MVC is the most popular one.
So we are going to stick to MVC design pattern, meaning how we can write a better code.
So let's get started.
When we say MVC, it simply means model view controller, and this is a design pattern.
Specify that an application consists of one data model two presentational information and three control
information, meaning that every application that is back in application comprises of three components.
One is the data flow inside your application and is being represented as the model and the view represent
the presentational part of your application.
And then the C represent what the control information.
So when designing an application, one can think of the MVC paradigm as dividing the element of your
application into three groups.
And the first one is what we call the model.
So when you say model, what does the mean where any code representing the knowledge or the data in
your application?
For example, database entries when seven files or in memory object and all this is what we call the
model.
The next component is what we call the view.
So view represent how models are displayed to the user, meaning how content are being displayed to
the user.
A sample of them is eight pages with some embedded JavaScript or XML documents or console.log output.
All these are what we call the view part of your application.
And lastly, we have what is called the controller.
Well, the controller take input from the user and then decide what to do with it based on the predetermined
or predefined rules.
An example of this is when submitting a form in a web application.
So controllers is where our business logic lies.
So for any application that you are going to build using Node.js, you need to have these components
and we are going to create an example application to explore or to show you how all these pieces come
together to form a complete design paradigm.
Well, so controller is where our business logic lies.
So again, always the controller.
Talk to the model, but a controller cannot talk to the view directly.
So it goes like this.
Well, we take an action from the controller to interact with our object, meaning our data base here.
And in case there are some changes, then it will display to the UI for the user to see.
So in a nutshell, this how MVC design pattern works.
So the next video, let's get started by building and complete API where we are going to differentiate
our application into these three components.
Let's get into that in the next video.