I'm back in the project and now I want to deploy this application.
So this is the project as we left it,
I didn't change anything.
Now the first thing is the base path,
we can see this in the
app.js file,
excuse me, in the index.js file where we have the browser router, there we could set the basename property
but I plan on serving my app from mydomain.com/nothing
so I don't need to set this. Now
the next thing is that I need to ensure that the server always returns to index.html file,
that is something all static hosts typically allow you to configure and if you're not using a static
host but you are using your nodejs server, you just need to write code, you need to set up a catch all
route and return index.html
and the same logic of course applies for any other server side language.
So for us here, the next step is to build the project and this is run with the npm command,
npm run build. This will now build our project, similar to npm start but now it will also spit out a folder
and not just store the result in memory and that folder will contain our optimized production build.
So there, we get this new build folder now in the project folder and if we have a look at this, we see
our single page which also is optimized to consume as little space as possible.
You'll see that some script imports were added there, like to this main js file and that is what we
can find in the static folder,
there we got our media files, images like the burger logo and the javascript files for our different
chunks for lazy loading and the main js file.
We also got source maps here,
now you don't need to deploy these though, these are purely optional,
you can focus on the javascript files but you can also and that is what I'll do deploy
the content of the whole build folder and that's important.
The content of the build folder, ship that content, all the files there and the static folder to your static
host.
So now let's deploy this.
We'll do this in the next lecture.