1
00:00:00,330 --> 00:00:00,750
Beautiful.

2
00:00:01,290 --> 00:00:06,990
And once we have the connection in place, once we can work with our database.

3
00:00:07,500 --> 00:00:13,290
Usually my next step is to set up the controllers as well as the rods.

4
00:00:13,620 --> 00:00:14,700
So essentially a structure.

5
00:00:15,150 --> 00:00:21,660
Now, of course, normally you cannot set up all the routes right from the start because you have more

6
00:00:22,050 --> 00:00:23,160
as you're developing.

7
00:00:23,160 --> 00:00:25,440
But this is the case where I already know all the routes.

8
00:00:26,130 --> 00:00:28,530
So that way we can right away test everything in a postman.

9
00:00:28,860 --> 00:00:34,230
So the basic set of works and then we don't have to jump around, especially from that point.

10
00:00:34,440 --> 00:00:38,190
We'll just work in the controllers and models.

11
00:00:38,640 --> 00:00:40,730
Now, of course, there's going to be some other stuff as well.

12
00:00:40,740 --> 00:00:46,110
But the point being is that we won't have to jump with every controller pretty much set up the controller

13
00:00:46,320 --> 00:00:50,340
that imported in the routes and hopefully get the gist.

14
00:00:50,820 --> 00:00:57,480
And the setup is going to be following where I want to create a controllers folder and I'm going to

15
00:00:57,480 --> 00:01:03,990
start off controller and it's my preference, the usually years of this type of naming convention.

16
00:01:04,349 --> 00:01:11,490
Similarly, because especially once we start working back in the client, there are going to be bunch

17
00:01:11,490 --> 00:01:13,110
of times over here.

18
00:01:13,650 --> 00:01:19,290
And then it's easier if you can clearly see whether or not you're the author, outer or auth controller.

19
00:01:19,590 --> 00:01:21,000
Again, it's my preference.

20
00:01:21,360 --> 00:01:27,540
So if you don't like that, you don't have to do it, then I want to create following functions and

21
00:01:27,540 --> 00:01:32,310
I'm right away showing the export basically what we'll be exporting and you want to create a function

22
00:01:32,700 --> 00:01:37,500
and then instead of the function, simple return with the rest, not stand and then function name.

23
00:01:37,740 --> 00:01:42,810
And this is again, just so we can quickly test everything in a postman because I'll set up all the

24
00:01:42,810 --> 00:01:48,240
crowds and I want to test whether the structure is in place, if it is.

25
00:01:48,630 --> 00:01:53,580
Then again, we don't have to repeat that step and then we want to create a route.

26
00:01:54,000 --> 00:01:56,940
And then in there, I want to go with Arthur out.

27
00:01:57,420 --> 00:02:00,210
I want to set up the express router.

28
00:02:00,780 --> 00:02:07,560
And if you already figure out how to do that, I'll show you and then we want import functions from

29
00:02:07,560 --> 00:02:08,400
off controller.

30
00:02:08,550 --> 00:02:12,300
Basically, these ones over here and then as far as our roots.

31
00:02:13,300 --> 00:02:18,820
Eventually, in a server, we'll use them in law, so we're going to go abduct years and then we're

32
00:02:18,820 --> 00:02:21,040
looking for API version one.

33
00:02:21,330 --> 00:02:26,890
Essentially, there's just signals that these are going to be API roads and then all the offer outs

34
00:02:27,160 --> 00:02:34,030
are going to go over here to, for example, and then we'll use our author order now in the order.

35
00:02:34,420 --> 00:02:36,020
The rules are going to be followed.

36
00:02:36,640 --> 00:02:43,510
Have a register which is going to be post, then log in and post request and update user will be a batch.

37
00:02:43,540 --> 00:02:44,160
My apologies.

38
00:02:44,170 --> 00:02:51,370
Actually, you'll see your me that it is a patch and then set it up in server, so we'll import author

39
00:02:51,760 --> 00:02:53,650
and set it up in server.

40
00:02:53,850 --> 00:02:59,560
I'll repeat the same steps with jobs as well and then test it out in the postman.

41
00:02:59,920 --> 00:03:01,480
So let's start over here again.

42
00:03:01,780 --> 00:03:03,580
This is in the root.

43
00:03:03,920 --> 00:03:08,070
We just keep that in mind and we're looking for controllers.

44
00:03:08,950 --> 00:03:10,150
That's the phone line.

45
00:03:10,270 --> 00:03:12,370
Or I'm sorry, folder name and line.

46
00:03:12,370 --> 00:03:13,450
We're looking for Auth.

47
00:03:14,550 --> 00:03:15,740
Our controller.

48
00:03:16,290 --> 00:03:21,510
So that's where the log in register, as well as update user functionality is going to be.

49
00:03:22,400 --> 00:03:28,310
And then, like I said, we want to create three functions we want to create register, which is going

50
00:03:28,310 --> 00:03:35,540
to be looking for Iraq and warez and and in here we're going to go with Iraq, not son.

51
00:03:36,260 --> 00:03:42,860
And then let's just send back register, register, use or whatever you want to do, and I'm going to

52
00:03:42,860 --> 00:03:44,900
copy and paste one two.

53
00:03:45,080 --> 00:03:47,850
And there's going to be three of them total.

54
00:03:47,930 --> 00:03:49,910
And then this won't be long in.

55
00:03:50,990 --> 00:03:53,540
And then this one will be logging as well.

56
00:03:54,530 --> 00:04:02,210
Morgan, so let's actually select maybe here both of them, and then let's right update.

57
00:04:03,190 --> 00:04:09,910
Update and user marks, so it's not going to be my function now, going to move this one and then I

58
00:04:09,910 --> 00:04:13,540
do want to that's off, say export and all three of them.

59
00:04:13,550 --> 00:04:18,040
So register log in as well as update user.

60
00:04:18,579 --> 00:04:25,750
So once we have it, I'll actually grab this object and you'll see one second, then we want to go back

61
00:04:25,750 --> 00:04:26,470
to the remote again.

62
00:04:27,680 --> 00:04:31,140
And we're looking for a route running side of the route.

63
00:04:31,160 --> 00:04:40,190
I'm going to go with off Harold James and then we'll set up the router in a second, but before we do

64
00:04:40,190 --> 00:04:41,720
anything, I'm just going to go with import.

65
00:04:42,650 --> 00:04:48,830
Then I want to copy and paste my object, and I'm just going to look for my controllers.

66
00:04:49,320 --> 00:04:52,280
So I was going to be one level up and in the controllers.

67
00:04:52,280 --> 00:04:57,470
I'm specifically looking for auth controller and I must have that gesture.

68
00:04:58,190 --> 00:05:04,490
And with this in place now, I can set up a router and in order to do that, we need to go with import.

69
00:05:04,790 --> 00:05:07,070
We're still looking for express.

70
00:05:07,550 --> 00:05:17,630
So from an express online, we need to go with express dot and router circle around or is equal to express

71
00:05:17,630 --> 00:05:20,870
and that router over here.

72
00:05:21,350 --> 00:05:22,280
Now invoke it.

73
00:05:22,580 --> 00:05:24,370
And now let's set up our roots.

74
00:05:25,040 --> 00:05:29,570
So let me go back to my read me just so I can double check.

75
00:05:29,990 --> 00:05:32,540
So I'm looking for router dot root.

76
00:05:33,080 --> 00:05:36,350
First, I'm registered and logged in update user post post.

77
00:05:36,650 --> 00:05:39,500
And the last one is going to be a patch.

78
00:05:39,680 --> 00:05:45,110
If you want, you can copy and paste brought in my case, I'm going to go with Router Dot Root.

79
00:05:45,620 --> 00:05:47,270
The first one will be register.

80
00:05:48,290 --> 00:05:52,530
This is going to be a post request, and then we want to pass in the register.

81
00:05:52,560 --> 00:05:54,620
Copy and paste and learn.

82
00:05:55,650 --> 00:05:56,510
Looks like I missed.

83
00:05:56,540 --> 00:05:57,260
Here they are.

84
00:05:57,650 --> 00:06:01,460
And by the way, this is an awesome, awesome extension that really helps me out.

85
00:06:01,750 --> 00:06:03,920
Notice this blue squiggly line.

86
00:06:04,520 --> 00:06:08,930
So the extension that I'm using is this one cold spell checker.

87
00:06:09,230 --> 00:06:09,890
That's the one.

88
00:06:10,310 --> 00:06:16,760
Now, even with this extension, I managed to make some dumb typos, meaning some spelling errors and

89
00:06:16,760 --> 00:06:17,120
all that.

90
00:06:17,120 --> 00:06:19,100
So it doesn't save me all the time.

91
00:06:19,100 --> 00:06:23,660
But this was the case where it nicely yelled at me and I was able to fix it.

92
00:06:24,110 --> 00:06:25,460
Just a quick settlement.

93
00:06:25,880 --> 00:06:32,900
And then in here, we want to go with a lot going on, so let's select both of them again and we're

94
00:06:32,900 --> 00:06:38,300
going to be looking for logging online and we want to go with our update user.

95
00:06:38,300 --> 00:06:38,630
Correct?

96
00:06:39,200 --> 00:06:44,270
So let's take these ones and then let's say they'd ears.

97
00:06:44,810 --> 00:06:45,560
Let's say it.

98
00:06:45,560 --> 00:06:47,530
Let's export our order.

99
00:06:47,570 --> 00:06:54,410
So export, export, default and then router and then back in the server.

100
00:06:55,420 --> 00:07:02,470
I guess right after the Connect DB, we can do that or right after middle order, that's really up to

101
00:07:02,470 --> 00:07:02,770
you.

102
00:07:03,040 --> 00:07:07,750
And I think I went in between, I don't know what actually came up with a comment that I on.

103
00:07:08,050 --> 00:07:14,440
I'm going to go here with Debbie and authenticate user, which we're going to set up later.

104
00:07:14,830 --> 00:07:20,560
But like I said, we're going to set it up in between where I'm going to go with routers and here I'm

105
00:07:20,560 --> 00:07:23,560
going to go with import run off router.

106
00:07:24,460 --> 00:07:30,340
And that is coming from in the roots, more specifically around jazz.

107
00:07:30,970 --> 00:07:35,950
Let's save it and then right off 30 home around.

108
00:07:35,950 --> 00:07:40,180
So this will still be our dominant part right after the home run.

109
00:07:40,300 --> 00:07:49,120
I want to go with app years and like I said, the path will be API version one went off and then I want

110
00:07:49,120 --> 00:07:52,360
to pass in my middleware, which will be my router.

111
00:07:52,570 --> 00:07:56,210
So off router over here.

112
00:07:56,740 --> 00:08:04,720
And once I set this one up before we go any further, let's also remember that since these will be a

113
00:08:04,720 --> 00:08:09,980
postrouting, we want to access the JSON that is passed then correct.

114
00:08:10,000 --> 00:08:10,840
We have request.

115
00:08:11,140 --> 00:08:12,160
And how do we do that?

116
00:08:12,190 --> 00:08:16,780
Well, we have a special built in middleware coming from Express.

117
00:08:17,170 --> 00:08:22,860
So back in the server before we go any further, I also want to go above all my roots and I'm going

118
00:08:22,860 --> 00:08:27,580
to use, abduct, use, express and adjacent over here.

119
00:08:27,640 --> 00:08:28,360
I'll invoke it.

120
00:08:28,360 --> 00:08:35,830
And again, I will just make the JSON data available to us in the controllers since we'll have post

121
00:08:35,830 --> 00:08:36,309
requests.

122
00:08:36,700 --> 00:08:44,500
We'll be looking for stuff and that stuff, that JSON data will be passed through us using the express,

123
00:08:44,770 --> 00:08:46,210
not adjacent middleware.

124
00:08:46,480 --> 00:08:55,180
And once we have this in place, we have successfully set up the structure for the auth controller and

125
00:08:55,180 --> 00:08:55,530
routes.

