All right.
So let's get started by deploying a really simple application.
Again it's just going to have two routes to templates really really simple.
The first thing I want to do is just make that application.
So I'll do that really quickly.
I made a new folder called deploying demo.
First thing I'll do is NPM and.
And I'm just going to go through most of these pretty quickly.
J.S. as my entry point.
Otherwise that's all we need to do.
The next thing that I'll do is NPM install Express and you also do E.J. s dash dash save and dash dash
.
Save is especially important right now when we're deploying.
We want to make sure that our package that Jason go ahead and open that up
we want to make sure that it has all of our dependencies because what happens is we're going to send
our code and our package that Jason over to her Roku using get actually is how we do it we're going
to send it to Heroku servers and then Heroku is going to run NPM install and install whatever's in the
package stuff Jason.
So in this case Ejay us and express So if we are missing something if we didn't have expressed in this
package that Jason Heroku wouldn't know to install it.
So the key is that we're not actually sending the node modules directory over.
That doesn't go all the way to Roku because there's no reason to do that that's a point of NPM instead
of sending these giant files and the entire directories the entire module of Express.
All we do is send the package that Jason that contains the instructions or the recipe we need Express
we need it.
Yes.
Sort of a shopping list and then Heroku will go and download all of that.
So we just want to make sure everything is here.
In this case it's really short and simple but when we get to Yelp camp we do want to do a thorough check
to make sure everything is there.
If you do forget something it's not the end of the world.
I'll show you how to do that I'll deliberately break it.
Once we put up camp so you can see how you fix it.
All right so next thing I want to do is make my app J J.S. and then I'm also going to make a View's
directory.
And then while I'm here let's make views slash and we'll just do home dad E.J..
Yes.
And the other one will call about that E.J. Yes.
Great.
So just two views.
We'll fill them in with really simple stuff.
So what we're going to deploy again.
One application with two routes two templates that are just going to be hideous.
Knowsley assess just the absolute bare minimum.
But you could take this and you know deploy a portfolio site or deploy a blog site or whatever you do
that doesn't require a mongo backend.
So let's open this up and start with their app J us
and up top.
First thing you want to do is say express equals require express and then we'll do that equals Express
running that function.
While we're here we'll say at the outset view engine to Ejay us and then all that we should need to
do now is declare our ropes.
So let's start with apt get just the home page or the route route
and we'll just do a rest render.
And we'll just what is our template home redstart render home just like that will do the same thing
except for slosh about and will result render.
About right.
So two routes with two different templates.
Now we need to fill in those templates.
So let's do home first
and fill that out.
So I'm going to just do an H-1 home page and we can add some thing later but let's just start with that
and do the same thing for about H-1
about Paige.
All right.
So we'll start there.
And the very last thing that we need before we can start our server is our after listen at the very
end.
All right so this is our super simple app should all be review from pretty early on in the Express portion
of this course.
So let's make sure things work.
Try running node apps.
Yes.
We didn't put a message out.
So it's working just doesn't look very nice or doesn't really tell us that it's working but it is then
let's go and preview our application.
Oop looks like we have a small issue no default engine was specified no extension was provided.
What do we have at the outset.
View engine.
And of course I messed that up.
It's not supposed to be a dash their view space engine.
Right.
So let's try that one more time.
Hopefully some of you caught that can refresh.
You can also quick This right here to open up in the browser.
You can see here we get our application think we can actually get rid of all of that.
There we go.
And if I go to slash about I get about page.
So are two super simple wraps and that's all that we're going to do.
Maybe we'll add in a link.
So if we go to home let's add in an anchor tag A-Trak should just be slash about.
Go to the About page and then we'll put this back or copy that over to the About page and have a link
to just the route.
Go home.
OK.
So let's verify that that works.
Go to the About page.
Go home.
Great.
So we have two routes.
Our application is done.
Awesome application right.
So I'll shut this down here believe.
There we go.
And the next thing that we'll do is actually work on deploying this.
So we're done with the app itself.
Again not exciting but it's it's the exact same idea if you're doing a beautiful well styled application
or a super simple to route express app.
The concepts are the same exact same code as far as the deployment is concerned