1
00:00:00,300 --> 00:00:05,440
Welcome back in the next few videos we're going to focus on creating this application with user art

2
00:00:06,030 --> 00:00:06,620
and to start.

3
00:00:06,630 --> 00:00:11,940
We need to set up the actual application structure you need to install a few packages including these

4
00:00:11,940 --> 00:00:14,170
up here that I talked about in the last video.

5
00:00:14,330 --> 00:00:18,600
And then we're going to add in two basic routes so we're not actually going to cover any authentication

6
00:00:18,600 --> 00:00:19,460
just yet.

7
00:00:19,680 --> 00:00:22,840
We're just going to lay the groundwork so that we can do that in the next video.

8
00:00:23,280 --> 00:00:28,290
So I made a new directory called authentication and I'll make a new directory inside of that called

9
00:00:28,860 --> 00:00:39,410
Auth. demo and CD into off demo and then will run NPM and it will just speed through this description

10
00:00:39,440 --> 00:00:39,520
.

11
00:00:39,550 --> 00:00:45,860
The blank I'd like to change that to actually yes Arthur.

12
00:00:47,010 --> 00:00:47,990
Yes that's OK.

13
00:00:48,260 --> 00:00:51,220
OK then let's make her address.

14
00:00:52,260 --> 00:00:55,410
Now we need to install her packages so we have quite a few.

15
00:00:55,530 --> 00:01:01,350
We need to install express mongoose passport body parser passport local.

16
00:01:01,350 --> 00:01:06,560
We also need passport local mongoose and express session quite a few.

17
00:01:06,660 --> 00:01:10,920
I'm going to do them in a few different lines even though it's nice to do it all in one line.

18
00:01:10,920 --> 00:01:14,540
It will be hard to watch on the video in case he gets cut off over here.

19
00:01:14,580 --> 00:01:21,060
So I'll start doing NPM install Expressen mongoose dash dash save.

20
00:01:22,080 --> 00:01:25,930
And then next we'll do passport and then passport local.

21
00:01:26,450 --> 00:01:26,840
OK.

22
00:01:26,930 --> 00:01:38,610
So now we'll do NPM install passport space pass or dash local dash dash save and that will give us two

23
00:01:38,610 --> 00:01:39,650
more.

24
00:01:39,660 --> 00:01:46,880
Next we're going to do NPM install passport local mongoose dash dash.

25
00:01:46,890 --> 00:01:58,530
Save now will do body parts for NPM install Audi parser and will also do session excuse me express session

26
00:02:00,270 --> 00:02:00,980
dash dash.

27
00:02:00,980 --> 00:02:03,860
Safe and that should be everything that we need.

28
00:02:03,870 --> 00:02:10,450
So let's take a look at the package that Jason and we have.

29
00:02:10,440 --> 00:02:17,580
Express express session mongoose passport passport local passport local mongoose and body parser.

30
00:02:17,610 --> 00:02:19,320
Quite a few packages there.

31
00:02:19,590 --> 00:02:23,670
All right so now let's head to the app chase and close that down.

32
00:02:23,670 --> 00:02:24,820
C9.

33
00:02:25,180 --> 00:02:25,830
Yes.

34
00:02:26,160 --> 00:02:32,070
And while we're in the terminal let's make our views directory just right there.

35
00:02:32,070 --> 00:02:38,790
There we go and let's also make a model directory and we're only going to have one model which will

36
00:02:38,790 --> 00:02:39,710
be user.

37
00:02:39,990 --> 00:02:41,560
And we'll get to that in the next video.

38
00:02:41,910 --> 00:02:45,210
So inside yes we'll start with our basic express app.

39
00:02:45,450 --> 00:02:55,690
So far Express calls require express and then we'll do a VAR app equals express just like that.

40
00:02:56,340 --> 00:02:58,440
And then we'll do some of our other configuration.

41
00:02:58,440 --> 00:03:06,450
So app that set view engine to be Ejay us and that is a package we actually forgot to install so we

42
00:03:06,450 --> 00:03:08,540
can do that now and install it.

43
00:03:08,620 --> 00:03:09,140
Yes.

44
00:03:09,210 --> 00:03:12,450
Dash dash save.

45
00:03:13,060 --> 00:03:17,550
And then while that's going we'll add our first route and we're just going to add the route route to

46
00:03:17,550 --> 00:03:17,880
start.

47
00:03:17,880 --> 00:03:26,600
So apt get slash and we'll just render a template that we call home.

48
00:03:26,850 --> 00:03:32,250
So rez that render home.

49
00:03:32,250 --> 00:03:33,990
Now we need to make the home template.

50
00:03:34,350 --> 00:03:37,710
So we have our views directory right here.

51
00:03:37,740 --> 00:03:47,130
Now we need to do touch views slash home that Ejay us and then will open that file up and we'll add

52
00:03:47,130 --> 00:03:54,800
in a simple H-1 that says this is the home page just like that.

53
00:03:55,770 --> 00:04:00,540
And then the very last and most important thing is to actually start the server to add the app up.

54
00:04:00,550 --> 00:04:13,080
Listen and remember its process that EMV that port Khama process that EMV IP comma callback function

55
00:04:13,080 --> 00:04:17,830
that will run and will just to cancel that log server started.

56
00:04:18,600 --> 00:04:19,620
There we go.

57
00:04:20,100 --> 00:04:26,070
Let's give it a shot and see if I'm missing anything important so let's clear this out and we run node

58
00:04:26,240 --> 00:04:27,510
after J S.

59
00:04:27,570 --> 00:04:29,360
All right it says server started.

60
00:04:29,370 --> 00:04:31,160
Now let's visit the URL.

61
00:04:31,350 --> 00:04:32,430
So the root path here.

62
00:04:32,460 --> 00:04:34,560
Just slash and we should get.

63
00:04:34,560 --> 00:04:36,570
This is the home page and we do.

64
00:04:36,570 --> 00:04:37,350
Great.

65
00:04:37,350 --> 00:04:43,570
Now let's set up the secret route which will just be another abduct get slash secret.

66
00:04:43,650 --> 00:04:50,370
And for now we're just going to render a template and that template will just say this is the secret

67
00:04:50,370 --> 00:04:54,170
page and we can add an embarrassing photo on there if you want.

68
00:04:54,330 --> 00:04:56,440
So secret just like that.

69
00:04:56,570 --> 00:04:58,370
And now we need to create that template.

70
00:04:58,650 --> 00:05:04,860
So touch use slash secret Ejaz and then we'll open that up

71
00:05:07,720 --> 00:05:10,080
and we'll add an H-1.

72
00:05:10,080 --> 00:05:16,420
This is the secret page and we can add a paragraph as well.

73
00:05:16,680 --> 00:05:23,220
You found me and then I'll add an image tag here with that horribly embarrassing photo of me.

74
00:05:23,400 --> 00:05:27,660
Feel free to put whatever you want as long as it's also horribly embarrassing and should be in the secret

75
00:05:27,660 --> 00:05:28,380
file.

76
00:05:28,740 --> 00:05:29,040
OK.

77
00:05:29,070 --> 00:05:32,530
Let's save it for now or restart the server.

78
00:05:32,880 --> 00:05:39,060
And we should be able to see that secret page because we don't have any authentication slash secret

79
00:05:39,070 --> 00:05:39,390
.

80
00:05:39,630 --> 00:05:42,650
And yes it works because we don't have our auth yet.

81
00:05:42,960 --> 00:05:43,460
Great.

82
00:05:43,470 --> 00:05:46,500
So that's pretty much all I wanted to get done in this video.

83
00:05:46,500 --> 00:05:55,320
One other thing we can do in the US is just start to add our mongoose code so we'll do a VAR mongoose

84
00:05:55,870 --> 00:06:04,200
equals require mongoose and then we'll just connect to a database with our mongoose that connects and

85
00:06:04,320 --> 00:06:11,400
that needs to be Mongo DB colon slash slash localhost slash and then whatever we want this to be called

86
00:06:11,850 --> 00:06:14,960
I'll just call it off demo app just like that.

87
00:06:15,480 --> 00:06:15,840
OK.

88
00:06:15,840 --> 00:06:17,750
And that's all the set up that we'll do in this video.

89
00:06:17,910 --> 00:06:22,320
We've now paved the way so that in the next video we can start creating the user model and importing

90
00:06:22,350 --> 00:06:24,000
all of those packages that we installed.
