I've met and met our basic functionality seems to be working, so now we can continue and set up Basic
Express Server, and I'll start by installing Node one because then I want to keep on typing.
Node server internal.
And once we install it on a site on tolerance thought as partners, Save Dev has the dependency essentially
in the package address, and I'll set up a script where I'll say Node Mount and server, so I will watch
the changes in the server and every time it will restart the server for me, whatever you want to install
express.
And since we are using six modules now that the Import Express from Express set up basic app and I don't
have a home around where I'll just send Malcolm online, we'll right away set up to port.
Because this is what we'll do in the following videos.
We will start utilizing the interview variables and I'm going to go with 5000.
That is important because remember that our front end is running on 3000.
So that's why I'm going with some kind of port that will not collide with a front end.
And this, of course, is going to be useful once we push this up to a production line at the very,
very end.
Why do I want to do it?
I want to go with that lesson.
We've learned whatever is the portfolio and then I passing the callback function just to check whether
everything is correct.
So let's start over here by installing the enrollment.
That's the first step.
Once node monitors in place, then we want to navigate to a package soon on the server.
That's very, very important.
We don't care about the script here.
We want to do is start line.
We'll just be looking for no non node mount and then server.
Let's save it.
Yep.
I have my dependency and now one side type and start.
Than my server is running.
And what's interesting, once we get the server up to speed as far as our frontline is concerned, viral
spin up both with a concurrently package so installed concurrently package.
And then we'll run both more on the server as well as the front end frontend, but that is still coming
up next when we want to do it.
Well, let's take a look at the preview.
So we're done with Node Monarch, and that's good.
The next one is installing the Express again.
I'll stop the server for now.
We'll grab the command here.
I'll be in post.
We installed on one.
Now let's set up our basic express server.
So let me run one more time and PM start.
So now again, I have the node one.
And now let's set up our express server.
So I'm going to close the sidebar.
I'm going to navigate to server address.
And first of all, we want to do is import express from Express Import Express from Express Package.
Man, let's set up right away.
The app now will be equal to express.
We invoke it inline.
Let's come up with the ports variable and then we'll set up the home run.
So let's go here with Konst Port is equal to process dot the envy.
So we're accessing the environment variables and we're looking forward to port one.
If it doesn't exist, then all hard code 5000 5000 when we want to invoke AMP, that lesson.
So essentially, our server is going to start listening on a port.
But the first time that we pass in the function and the second is going to be the callback function
to arguments first, one port, second, one callback function once the server spins up and and in here
we want to go with log and let's use a template string and I'll say server is listening port and now
let's access the port variable.
And then let's just go with on that.
Let's say it.
And it looks like everything is working.
So now I can go above the port and let's set up some dummy route, which in my case is going to be a
home run.
Now, don't worry.
Of course, we'll add more sophisticated set up in the second.
So Rec André's those are our two parameters, and I'm just going to go with resonant sound and we're
looking for a welcome.
So let me invoke this one and I can navigate to my browser now.
At the moment, I have localhost 3000, which is going to crash since there's no dev server backing
this up.
But if I go here with localhost, I'm not five thousand.
I should see my welcome.
And what I do.
So now we know that everything is working.
Most importantly, our imports.
So that was the key thing where we did set up that time module.
And now we can start using, yes, six modules in node land.