Welcome back in the next few videos we're going to focus on creating this application with user art
and to start.
We need to set up the actual application structure you need to install a few packages including these
up here that I talked about in the last video.
And then we're going to add in two basic routes so we're not actually going to cover any authentication
just yet.
We're just going to lay the groundwork so that we can do that in the next video.
So I made a new directory called authentication and I'll make a new directory inside of that called
Auth. demo and CD into off demo and then will run NPM and it will just speed through this description
.
The blank I'd like to change that to actually yes Arthur.
Yes that's OK.
OK then let's make her address.
Now we need to install her packages so we have quite a few.
We need to install express mongoose passport body parser passport local.
We also need passport local mongoose and express session quite a few.
I'm going to do them in a few different lines even though it's nice to do it all in one line.
It will be hard to watch on the video in case he gets cut off over here.
So I'll start doing NPM install Expressen mongoose dash dash save.
And then next we'll do passport and then passport local.
OK.
So now we'll do NPM install passport space pass or dash local dash dash save and that will give us two
more.
Next we're going to do NPM install passport local mongoose dash dash.
Save now will do body parts for NPM install Audi parser and will also do session excuse me express session
dash dash.
Safe and that should be everything that we need.
So let's take a look at the package that Jason and we have.
Express express session mongoose passport passport local passport local mongoose and body parser.
Quite a few packages there.
All right so now let's head to the app chase and close that down.
C9.
Yes.
And while we're in the terminal let's make our views directory just right there.
There we go and let's also make a model directory and we're only going to have one model which will
be user.
And we'll get to that in the next video.
So inside yes we'll start with our basic express app.
So far Express calls require express and then we'll do a VAR app equals express just like that.
And then we'll do some of our other configuration.
So app that set view engine to be Ejay us and that is a package we actually forgot to install so we
can do that now and install it.
Yes.
Dash dash save.
And then while that's going we'll add our first route and we're just going to add the route route to
start.
So apt get slash and we'll just render a template that we call home.
So rez that render home.
Now we need to make the home template.
So we have our views directory right here.
Now we need to do touch views slash home that Ejay us and then will open that file up and we'll add
in a simple H-1 that says this is the home page just like that.
And then the very last and most important thing is to actually start the server to add the app up.
Listen and remember its process that EMV that port Khama process that EMV IP comma callback function
that will run and will just to cancel that log server started.
There we go.
Let's give it a shot and see if I'm missing anything important so let's clear this out and we run node
after J S.
All right it says server started.
Now let's visit the URL.
So the root path here.
Just slash and we should get.
This is the home page and we do.
Great.
Now let's set up the secret route which will just be another abduct get slash secret.
And for now we're just going to render a template and that template will just say this is the secret
page and we can add an embarrassing photo on there if you want.
So secret just like that.
And now we need to create that template.
So touch use slash secret Ejaz and then we'll open that up
and we'll add an H-1.
This is the secret page and we can add a paragraph as well.
You found me and then I'll add an image tag here with that horribly embarrassing photo of me.
Feel free to put whatever you want as long as it's also horribly embarrassing and should be in the secret
file.
OK.
Let's save it for now or restart the server.
And we should be able to see that secret page because we don't have any authentication slash secret
.
And yes it works because we don't have our auth yet.
Great.
So that's pretty much all I wanted to get done in this video.
One other thing we can do in the US is just start to add our mongoose code so we'll do a VAR mongoose
equals require mongoose and then we'll just connect to a database with our mongoose that connects and
that needs to be Mongo DB colon slash slash localhost slash and then whatever we want this to be called
I'll just call it off demo app just like that.
OK.
And that's all the set up that we'll do in this video.
We've now paved the way so that in the next video we can start creating the user model and importing
all of those packages that we installed.