Okay.
And up next, let's prepare for deployment.
We're basically we want to add a few scripts to the package JSON and we want to simulate the server
environment.
We need to keep in mind that once we push this up to a server, the platform we're going to use is going
to be looking for two things.
The command we want to run every time, basically deployment starts.
So in our case, that is we want to install client dependencies, we want to set up production build
and we want to run the NPM install for server.
So we also want to install dependencies on the server and then we'll have to provide a command like
for example, node server, which is going to spin up our application.
And therefore in this video.
We'll set up those commands.
We'll set up two of them.
So we already have the I believe it was build client.
Correct.
Which built out the production ready application on the client.
Now we'll go with install client.
So now install dependencies and then we'll set up that command.
So this is the command we will run on the server.
Now, please keep in mind that by the end of the video, this video, the application needs to work
locally.
It's not going to magically start working on the server.
If it doesn't work locally, then you need to troubleshoot.
Please keep that in mind.
And in order to simulate the server environment in a client, we will remove two folders.
The build one and other modules effectively will start from scratch and the same goes on the server.
We will remove the node modules, then we'll set up the commands, then we'll run them and we'll see
whether everything works by the end of the video or application, in my case at least, needs to work
perfectly on local host.
5000, so not 3000.
We're not going to be using concurrently anymore.
5000.
And the reason why I keep.
Repeating this.
Is because.
Once in a while I get the questions about the deployment.
And when I take a look at the project, I can see that it doesn't work locally.
So there's no magic on the server.
If it doesn't work locally, it's not going to work on the server.
Hopefully that is clear.
So now let's start with a cleanup.
First, let's remove, build and the node modules from the client.
So start here from the scratch.
Here.
And here.
Great.
Good.
Then we want to remove the node modules.
From the server and this is totally optional, but I'll also remove the package lock just because.
So let's remove it.
Now, let's navigate to the script and let's add those additional scripts.
And as they're not, we might as well can stop.
Right now the server.
So let's go to package JSON on a server and this is not happening on a client.
In fact, I'll close it here.
We're looking for package JSON on a server and in the previous, in one of the previous videos, we
set up this build client, correct again, which created that production ready application.
Now we want to install dependencies as well and then we want to run both of them plus.
Installed dependencies on the server.
So think of this way we want to install dependencies on a client.
We want to build production or the application on the client, and then we want to install dependencies
on the server and at the very end we'll run the server and as a result, our application, the entire
application is going to run on the server.
So let's try this one out where we want to go with install client.
And here the value is going to be CD client.
So again, we'll navigate over there.
However, we'll go and PM install.
Now we install those dependencies and now let's set up that command that pretty much is going to do
all of the heavy lifting, let's say here, set up production and then let's run first install client.
So now PM around install client.
So this is the command that we just created.
Client Then we want to run, build.
Client Look me out of comma here because there's a bug show, NPM, run, build Client And then lastly
we want to go with and PM and install so that installs on the server and I'm not going to repeat what
these two are doing.
You can clearly see that.
So a build client, install client or just make sure that there are no typos because I'm an expert on
doing them.
And now let's go to a terminal, let's clear everything, then we'll run and PM run, set up production
like so we'll run that one first.
You'll see that we're installing the client.
And as I don't, yes, it's going to take a little bit of time, so I'll kind of stop the video.
I'll mention what we're doing and then we'll resume it.
Once we're done installing dependencies.
Now we're setting up the production build.
So now we're building that production ready application on a client, and now we're done with the client
and we're installing dependencies on the server and once the command is complete.
Then we want to go with Node and then what is the name of your file?
In my case, that is server and.
Everything should work on local.
Host 5000 again.
Not 3000 anymore.
5000.
So if I go to 3000, I should get an error because there is no running server that supports that.
So now let's go to local host 5000 and notice.
That's my John user.
Quickly just add a job and I mean if that works, then everything else should also work.
So front end and then let's say Apple here, let's submit everything seems to be working.
And if I go to all the jobs.
Yep, there it is.
And let me just quickly test.
Lead them all up.
And if that works, then for sure.
Everything is ready to go.
So effectively, then we can set up the GitHub repository and hosted on the render platform.