Welcome, everybody, welcome back.
And now we going to lean we got recording records from the database like -- HEB Kompass In Session,
we are going to learn how to make a connection between a receiver sites and A rate -- B Kompass
So it is very simple.
OK, and our shopping cart is our reactivates project and we are going to create a not if you're not
a floater, that's a name server and the server is going to be connected to a remote Zibi database.
And we are going to make also communication between our shopping carts, which is a reacts project,
which is the in the front and sites and our server in order to serve some requests from arrays to send
since some requests from our shopping cart, which is a great project to our database that a the server
side.
OK, so this is what we're going to do, because if I try to back here in our application, we are going
to complete this part by filling this information.
When we click on VALIDATE, the desire is to get the cards, the name of the clients, OK, and all
the orders a safe in our database.
And then we can view these orders in a way in our admin site.
So this is what's required.
So let us big first reactor.
Just application.
Yes, or what's regular?
I'm going to back in Orange Visual Studio code, yes.
So what's required?
I'm going to open a new auditorium in all we are in sort of relaxed project.
So what I'm going to do, I'm going to create a new folder in our research project.
We're going to name that's Reglan name server.
And I'm going to say, McDouall, I'm going to say a server like this, I'm going to presenter.
OK, I'm going to clear you're going to see we have a new folder here, which is for a server.
And I'm going to go inside here or say there and I'm going to initialize our server by typing this command
npm init here.
And I'm going to say it's all by default, by pressing answer.
I like this and I'm going to clear and if it's right to open this for its folder, you're going to see
we're going to have a pickiest Jason like this.
OK, we have Pegues, Jason, in which we have all this.
And the thing now we're going to do is to install, express and express is our server OK?
And we're going to install also we're going to install also Mongo's.
Mongo's allows us to make connections between our server sites and our database.
And after that, we are going to install also calls cause it allows us to make communication, to make
communication between our server and our react application, which is a shopping cart, and just come
here.
Instead of our server folder, we are going to install X-rays, Mongo's and course by tapping this command
NPM Install Express.
OK, the first thing express, the second one is mambos.
We're going install Mongoose and after that we're going to finish by installing course and space.
That's that's safe press center.
And we're going to wait for a couple more minutes.
The installation of our display, which is.
Yes, very good.
We have finished, you can see inside of our server.
We have not modulars, we have taken sortation.
And instead of our package of tests on that, we have initializes.
You can see here have three dependencies that we have just installed our different packages.
We, of course, Express and Mongo's.
And if we try to open on your not module, you're going to find all these packages for the first thing
we're going to say, we're just coarse and coarse is here.
OK, you can see we have corsia.
And the second thing we have expressed, yes, we have expressed here.
And the other thing is Mongo's is Mongo's.
We have Mongo's here, OK, and very simple.
And let us close our node module.
And the thing we want to know is through creates a new file.
So I'm going to close this.
It is.
And in the days ahead, flurried creates its OK, I'm going to close this and I'm going to come in our
server, I'm going to create a new OK, a new file that I'm going to name indexed the chase inside of
it.
So therefore because if you try to see the information about our initial initialization you're going
to see the main file is indexed.
Doty's So make sure Stotra creates a main file in our server with this Ninh because this will pontes
in the minford, which is going to be in our server, which is going to be indexed the JS and I'm going
to radically new file and I'm going to name this index that they select is OK.
And instead of our index dodgiest, we're going to try to make connection between our server site and
our database.
So the first thing open your mind, would you be Kompass after installation?
It is very simple.
You're going to find your password and it is very simple to install.
Just click on next, next, next.
But make sure to be on line.
Otherwise, it's Kentz Week.
OK, so we're going to wait for a couple more minutes.
Mom would would be composter databased.
Very good.
You can see we have a remember to be Kompass here and there.
Don't worry about all the things that we have in our left side here.
I have already created several projects, so don't worry about it.
I, I, I know that in your case, if you didn't see it, use more TB and you have the different things
just in the left here, so don't worry about it.
So we have already opened our compost.
KOMPASS The second thing we're going to do here is to make connections between our server sites and
our Modiba database.
So the first thing we're going to create a Constancia we cannot say Coles Express is equal to require.
Express is OK, and when you say calls express, require express, you mean that means you x respond
to our package to Tayshaun, which is here, instead of all dependencies we have expressed here.
That means your express can't pass here, which is our packets inside of it, not module.
And this express directly points to our express package, which is in our module.
That means you can now access in our packages, which is in our server in Express, which is not modules.
And the second thing we're going to do is to say const, OK, we're going to create an cost that's we're
going to call up and here we are going to call and express my putzing and like this.
Yes.
And the third thing is to call momos because Mongo's allows us to make connection between our server
site and our TB database.
I'm going to say const Mongo's require.
Require Mongo's, that is.
Mongo's and I'm going to come here and now we are going to make a connection between our server sites
in our database by taking.
Mongo's, which is a subject that we have created and we are going to say Mongo's connects, OK, Mongo's
connects like this, and here we are going to have two parameters, different forum to make.
The first parameter is going to be in such yardie the length of our connection.
OK, because we are working in local.
OK, so what is this link you're going to have to sleep in Itachi to file a case or not remove or let
us see.
OK.
We have it like this, you took a look, and if this is this link, OK, and the second is they're using
your powers.
So if you want to work on.
So make sure to put all this.
OK, so what we're gonna do here, you can see inside of a between arrest, slush, slush and a question,
Mike, between this question mark are slush inside here we are going to put the name of our database
that's we are going to create in our numbers and in our database in our would be compas.
So in these moments, I'm going to take you through this link.
I'm going to copy and I'm going to come here in our Modiba Kompass and I'm going to pass it here and
I'm going to connect if I want to be connected on local with our community.
KOMPASS And you're going to see this different database I have already created on local.
OK, and when we are going to launch our application in our server site, like when we are going to
mix integration between different insights, our reality is how to save data.
You're going to see it automatically creates a database instead of array.
Moseby Kompass.
And here in our case, our database is going to be orders like this.
OK, I'm going to put it like this.
And the other thing we're going to do is to test the connections.
So what we're going to say we are going to take up here, we're going to say up is equal to release
then and here.
The first thing we are going to do in the first parameter, we are going to customize the ports, the
ports, the number of our server sites, because our end sites, shopping carts are a projects Aysgarth
in ports, which is 3000, localhost 3000.
And in our case, we are going to customize our server ports, which is going to be three thousand and
one.
And after that, we are going to create any real function.
We are going to say like this, we're going to create a new function and here we are going to make a
console like in which we are going to return this message by saying you are connected.
If we want to test the connection, OK, we are going to say you are connected like this.
Very good.
We have you are connected.
Okay.
So and we are going to test this.
I'm going through.
Make Leptis OK.
We're going to see clear.
OK, and so we're going to test the connection between this ring and say not OK, index the chest,
we're going to run index to chase by press.
We're going to press onto it as well.
Very good.
You're going to see if you are connected.
That means a direct connection wake.
And if you try to take this number and come in over a browser.
So we're going to inspect something.
Let us push, for example, one like this press center, OK, we have eera cannot get.
And once you see this, it means that it's stonewalled, OK?
It means that it's Wick's.
But you can understand in the future why it does not work in these moments where we have zero.
But once you see already this message here, make sure that it's OK.
We're going to see what you did in the future so we can make now over.
Yes, here we go.
Starts with localhost.
Localhost.
Localhost is.
Very good.
So let us back here and you see that the connection and on.