All right.
And before we start setting up the code in the front end, I also want to set up the concurrently package,
which will allow us to spin both of them up with the same command.
So effectively, yeah, I mean, we can open up two terminal windows and start them up one by one,
but at least in my opinion, it's faster if you have only one command.
So here's what we want to do.
First of all, let's close both of them.
For now, we won't need them in order to install the package.
Let me showcase.
You're looking for this command.
So you want to go with NPM I and then concurrently package and then in the scripts we're going to set
up two more scripts, one to set up the server.
So in this case we just go with Node one and then server and then client.
So first we navigate to the client and then we go with NPM run dev and then the dev command actually
is going to be concurrently.
So that's the package.
Then we have kill others on fail.
And yes, I mean I find also this name extremely funny.
Whoever came up with that name, I'm not sure what they were thinking.
Probably they could have used something else.
But essentially it just means that if one of the commands fail, for example, NPM server, then it's
not going to spin up the client.
So don't freak out by this name.
At least I find it extremely funny.
And once we have this in place we will just run npm run dev and it's going to spin up both of them.
So first let's navigate back.
Notice I have this watch one with the.
Hyphen hyphen, watch flag, so I'm not going to use it at all.
And I'll remove the dev for now.
So start from the scratch.
So this is going to be to set up the project again, super, super useful and therefore we'll keep it.
We want to look for server, it's going to be my command and basically we go here with Node.
Server.
If you want, you can add JS over here and we want to add a comma over here as well and we want to set
up the client.
Let's set it equal to CD.
So first we want to navigate to the client folder and then we want to go npm run dev.
Then let's add a comma and now let's finally set up the command we're going to use.
And yes, pretty much I'm sticking to this NPM run dev because we have that already on the client and
I think it's just easier to remember otherwise.
I mean, while I'm recording, I'll definitely forget which command I have for the server and for the
frontend and all that.
So we want to go here with this funny name concurrently, which as a side note, I always make errors
when I have to spell it.
And here let's go with kill others.
On fail.
And essentially this is where we provide the commands we want to run together.
And as far as the syntax, the package uses the escape syntax.
So what am I talking about?
Well, for example, if I want to run npm run server, notice how?
Everything turns red over here.
So in order to fix it, we need to look for the quotation mark and add the escape.
And the same goes with the closing one.
So look for the closing quotation mark and then add the escape.
And now notice how everything looks good.
And we want to do the same thing with NPM run client.
So let me just copy and paste.
I think it's going to be faster.
And let's just change it around.
So this is not going to be server, it's going to be client.
Then let's open up the terminal.
And now again, we're looking for NPM run and dev and check it out.
If everything is correct, not only our server is going to be running on 5100, but also our local host.
And with this in place, we are ready to move on to the next step.