Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,160 --> 00:00:03,510
Let's now completely refactor
2
00:00:03,510 --> 00:00:05,710
our application that we have so far,
3
00:00:05,710 --> 00:00:07,520
and create a lot of new files,
4
00:00:07,520 --> 00:00:09,623
and a whole new file structure.
5
00:00:11,130 --> 00:00:13,063
So remember from the last video
6
00:00:13,063 --> 00:00:15,470
that we wanted to separate our routers
7
00:00:15,470 --> 00:00:16,570
into different files.
8
00:00:16,570 --> 00:00:19,520
And so that's gonna be the first step that we will do here.
9
00:00:20,550 --> 00:00:23,843
So I'm gonna create a new folder called Routes now,
10
00:00:26,630 --> 00:00:30,960
and then in there I will have one folder for tour routes
11
00:00:34,117 --> 00:00:37,203
.js, and then user routes,
12
00:00:39,777 --> 00:00:41,800
.js as well.
13
00:00:41,800 --> 00:00:44,520
Okay, and so this is gonna be the first time
14
00:00:44,520 --> 00:00:48,070
that we will really work with different modules,
15
00:00:48,070 --> 00:00:51,783
okay, and actually use them in a very meaningful way.
16
00:00:53,290 --> 00:00:56,693
So, let's start with the tour router.
17
00:01:00,300 --> 00:01:05,293
Copy it here, then take this tour router here,
18
00:01:07,500 --> 00:01:08,593
and put it here.
19
00:01:10,190 --> 00:01:13,640
And so, next we need actually Express here,
20
00:01:13,640 --> 00:01:15,380
because we're using that variable,
21
00:01:15,380 --> 00:01:18,893
and so we need to import the Express module.
22
00:01:22,190 --> 00:01:23,303
So express,
23
00:01:26,780 --> 00:01:29,010
require express.
24
00:01:29,010 --> 00:01:33,550
Okay, it's kind of a convention to simply call this router,
25
00:01:33,550 --> 00:01:34,940
and not tourRouter.
26
00:01:36,110 --> 00:01:39,880
So router, and now we will export the router,
27
00:01:39,880 --> 00:01:43,423
and then import it into our main application, okay?
28
00:01:45,110 --> 00:01:47,170
So, remember how we do it
29
00:01:47,170 --> 00:01:49,860
when we only have one thing to export?
30
00:01:49,860 --> 00:01:52,870
Well, we use module.exports,
31
00:01:52,870 --> 00:01:56,053
and then put the router on there.
32
00:01:57,430 --> 00:02:00,810
Give it a save, and of course, we still get some errors,
33
00:02:00,810 --> 00:02:02,210
but that's because the tour router
34
00:02:02,210 --> 00:02:05,313
is not defined in our main application file.
35
00:02:06,290 --> 00:02:09,509
Okay, also what's not defined in this file
36
00:02:09,509 --> 00:02:12,060
is all of these functions here.
37
00:02:12,060 --> 00:02:14,830
Okay, so let's very quickly get them,
38
00:02:14,830 --> 00:02:17,100
and put them in the router file.
39
00:02:17,100 --> 00:02:19,700
At least for now, we will later create
40
00:02:19,700 --> 00:02:22,270
a new file for that as well.
41
00:02:22,270 --> 00:02:24,123
So it starts here.
42
00:02:26,010 --> 00:02:27,803
Careful, not copying everything.
43
00:02:31,500 --> 00:02:33,633
Yeah, so just like this.
44
00:02:36,250 --> 00:02:39,213
And actually, I'm gonna put them before the routes.
45
00:02:41,820 --> 00:02:42,703
Give it a save.
46
00:02:43,930 --> 00:02:45,330
And so that should work now.
47
00:02:46,910 --> 00:02:49,453
And now do the same for the user.
48
00:02:53,390 --> 00:02:55,033
So get the router.
49
00:02:56,860 --> 00:02:59,560
And don't worry about all these errors that we're getting.
50
00:02:59,560 --> 00:03:01,770
Again, that's just because we are missing
51
00:03:01,770 --> 00:03:03,270
some variables in some places.
52
00:03:04,640 --> 00:03:06,363
So again, we'd express here,
53
00:03:12,250 --> 00:03:14,253
then we call this here just router,
54
00:03:16,720 --> 00:03:17,820
and then we export it.
55
00:03:27,150 --> 00:03:30,673
Okay, and now I'm also getting the handlers.
56
00:03:39,620 --> 00:03:43,710
Okay, so we can get rid of these route handlers now.
57
00:03:43,710 --> 00:03:46,340
Okay, and actually this one here is missing
58
00:03:46,340 --> 00:03:47,940
in our tour routes,
59
00:03:47,940 --> 00:03:51,240
so this piece of code where we actually read
60
00:03:51,240 --> 00:03:53,063
the tours from the JSON file.
61
00:03:56,479 --> 00:03:58,179
So put that right at the top here.
62
00:03:59,410 --> 00:04:01,610
And now finally, we actually need to import
63
00:04:01,610 --> 00:04:04,290
the tour router and the user router
64
00:04:04,290 --> 00:04:06,833
so that these routes here continue to work.
65
00:04:07,830 --> 00:04:11,593
Okay, but that should be fairly easy, so let's do that.
66
00:04:16,298 --> 00:04:17,498
So with the tour router,
67
00:04:19,200 --> 00:04:20,683
is at require,
68
00:04:23,260 --> 00:04:24,953
routes/tourRoutes.
69
00:04:27,890 --> 00:04:31,510
Okay, and we don't need the JS,
70
00:04:31,510 --> 00:04:34,280
and then the same for the userRouter.
71
00:04:37,341 --> 00:04:41,258
So tourRoutes actually is here, the userRoutes.
72
00:04:43,140 --> 00:04:45,260
Now you might be wondering why I actually called
73
00:04:45,260 --> 00:04:47,410
the variables the userRoute,
74
00:04:47,410 --> 00:04:49,380
but then the file is userRoutes,
75
00:04:49,380 --> 00:04:52,400
and well that's because this folder here is called routes,
76
00:04:52,400 --> 00:04:55,780
and so in there we have the tourRoutes and the userRoutes.
77
00:04:55,780 --> 00:04:58,650
Okay, but what we actually export from that file
78
00:04:58,650 --> 00:05:01,130
is simply the router, alright?
79
00:05:01,130 --> 00:05:02,680
But I believe it makes more sense
80
00:05:02,680 --> 00:05:05,890
to actually call this folder here Routes.
81
00:05:05,890 --> 00:05:08,010
Okay, and so that's why we have this small difference
82
00:05:08,010 --> 00:05:10,410
between routes and router.
83
00:05:10,410 --> 00:05:12,490
Now we still get some error here,
84
00:05:12,490 --> 00:05:15,200
and so fs is not defined,
85
00:05:15,200 --> 00:05:18,150
so let's take that, and actually we don't need it here,
86
00:05:18,150 --> 00:05:23,023
so let's put it in the tour routes right here.
87
00:05:24,730 --> 00:05:26,450
We get another error.
88
00:05:26,450 --> 00:05:30,440
And this time, because this folder here is now not defined,
89
00:05:30,440 --> 00:05:34,120
because our dirname is now the routes.
90
00:05:34,120 --> 00:05:36,430
So we need to get out of that.
91
00:05:36,430 --> 00:05:39,090
So go up one folder, and then in there,
92
00:05:39,090 --> 00:05:42,130
go into dev-data, data, and tour-simple.
93
00:05:42,130 --> 00:05:44,320
Now don't worry about getting all these errors.
94
00:05:44,320 --> 00:05:47,850
That's kind of normal when we are doing all this refactoring
95
00:05:47,850 --> 00:05:49,890
'cause we're changing stuff all over the place,
96
00:05:49,890 --> 00:05:52,163
so it's normal that stuff breaks.
97
00:05:53,270 --> 00:05:56,010
Anyway, it's now back to working,
98
00:05:56,010 --> 00:05:58,820
and so we are now in the place where we can
99
00:05:58,820 --> 00:06:00,763
retest our routes here.
100
00:06:02,150 --> 00:06:04,490
And indeed, it works.
101
00:06:04,490 --> 00:06:06,910
The same for the users, let's suppose.
102
00:06:06,910 --> 00:06:10,000
And so everything is correct.
103
00:06:10,000 --> 00:06:13,760
So we have our routers now each in one different file,
104
00:06:13,760 --> 00:06:15,540
and we can say that each of them
105
00:06:15,540 --> 00:06:17,970
is one small sub-application.
106
00:06:17,970 --> 00:06:21,120
So one tour application and one user application.
107
00:06:21,120 --> 00:06:24,290
And we then put everything together in our global app file
108
00:06:24,290 --> 00:06:26,200
by importing these routers,
109
00:06:26,200 --> 00:06:28,050
and then mounting the routers
110
00:06:28,050 --> 00:06:29,720
on the two different routes
111
00:06:29,720 --> 00:06:32,550
that we have currently implemented, okay?
112
00:06:32,550 --> 00:06:36,020
So again, this is where we mount our routers.
113
00:06:36,020 --> 00:06:37,360
And I know that this concept
114
00:06:37,360 --> 00:06:39,710
can be a bit difficult to grasp,
115
00:06:39,710 --> 00:06:40,910
but don't worry about that.
116
00:06:40,910 --> 00:06:43,230
The longer that you keep working on this project
117
00:06:43,230 --> 00:06:45,000
and the more code you keep writing,
118
00:06:45,000 --> 00:06:48,260
the clearer everything will automatically become.
119
00:06:48,260 --> 00:06:50,640
For now, the most important thing to keep in mind
120
00:06:50,640 --> 00:06:53,020
is that we created these different routers
121
00:06:53,020 --> 00:06:55,390
for each of the resources to have a nice
122
00:06:55,390 --> 00:06:58,910
separation of concern between these resources.
123
00:06:58,910 --> 00:07:02,750
So basically creating one small application for each of them
124
00:07:02,750 --> 00:07:06,720
and then putting everything together in one main app file,
125
00:07:06,720 --> 00:07:08,640
which is of course this one.
126
00:07:08,640 --> 00:07:11,060
So this app.js file that we have here
127
00:07:11,060 --> 00:07:14,490
is usually mainly used for middleware declarations.
128
00:07:14,490 --> 00:07:15,900
So we have all our middleware
129
00:07:15,900 --> 00:07:18,630
that we want to apply to all the routes.
130
00:07:18,630 --> 00:07:21,610
So in this case, we have these four middlewares here.
131
00:07:21,610 --> 00:07:23,240
So one, two, three, four.
132
00:07:23,240 --> 00:07:27,240
These middlewares, we want to apply it for all of the routes
133
00:07:27,240 --> 00:07:29,050
and then for this route,
134
00:07:29,050 --> 00:07:32,576
we want to apply the tourRouter middleware,
135
00:07:32,576 --> 00:07:34,160
and for this route, we want to apply
136
00:07:34,160 --> 00:07:36,430
the userRouter middleware.
137
00:07:36,430 --> 00:07:40,440
Okay, so again, these two routers are actually middleware,
138
00:07:40,440 --> 00:07:45,010
which is why we can use app.use in order to mount them.
139
00:07:45,010 --> 00:07:46,740
Okay, and with that being said,
140
00:07:46,740 --> 00:07:48,820
let's take it one step further,
141
00:07:48,820 --> 00:07:52,100
and actually remove these route handlers
142
00:07:52,100 --> 00:07:53,890
from the routes file.
143
00:07:53,890 --> 00:07:57,870
Okay, and so let's again create a new folder here,
144
00:07:57,870 --> 00:08:01,500
and this one will be called controllers, okay?
145
00:08:01,500 --> 00:08:03,810
So I've been calling them route handlers,
146
00:08:03,810 --> 00:08:07,270
and so it would make sense to create a handlers folder.
147
00:08:07,270 --> 00:08:08,350
But later in this course,
148
00:08:08,350 --> 00:08:10,610
we will start using a software architecture
149
00:08:10,610 --> 00:08:12,820
called the Model View Controller,
150
00:08:12,820 --> 00:08:15,720
and in that architecture, these handler functions here
151
00:08:15,720 --> 00:08:17,750
are actually called controllers.
152
00:08:17,750 --> 00:08:20,860
And so that's why I'm going to call the folder,
153
00:08:20,860 --> 00:08:23,433
and also the files in there, controllers.
154
00:08:24,510 --> 00:08:28,893
So let's now create the tourController.js,
155
00:08:31,800 --> 00:08:33,743
and the userController.js.
156
00:08:36,610 --> 00:08:39,130
Okay, and this will make a bit more sense
157
00:08:39,130 --> 00:08:41,590
once we reach the part of the course
158
00:08:41,590 --> 00:08:44,159
where we actually talk about the MVC,
159
00:08:44,159 --> 00:08:45,913
or Model View Controller pattern.
160
00:08:46,930 --> 00:08:50,563
Alright, so let's now take this code,
161
00:08:53,070 --> 00:08:56,820
and put these handlers into the controller folder,
162
00:08:56,820 --> 00:08:57,983
or file actually.
163
00:08:59,050 --> 00:09:00,543
So all of this code.
164
00:09:02,660 --> 00:09:05,660
It's the tourController, yeah, that's the one.
165
00:09:05,660 --> 00:09:09,600
Also, we need this FS module here,
166
00:09:09,600 --> 00:09:10,913
obviously at the top.
167
00:09:12,624 --> 00:09:13,457
And here we go.
168
00:09:13,457 --> 00:09:16,730
Now, we want to actually export all of these functions
169
00:09:16,730 --> 00:09:19,340
from this module, so how do we do that?
170
00:09:19,340 --> 00:09:22,680
Well, in this case we do not only have one export,
171
00:09:22,680 --> 00:09:24,970
so we're not gonna use module.export,
172
00:09:24,970 --> 00:09:27,740
but instead we will put all of these functions
173
00:09:27,740 --> 00:09:31,070
on the exports object, okay?
174
00:09:31,070 --> 00:09:34,453
And so let me select all of these,
175
00:09:36,897 --> 00:09:40,340
consts, so that I can actually
176
00:09:40,340 --> 00:09:42,040
replace them all at the same time.
177
00:09:46,360 --> 00:09:51,360
So exports.deleteTour, and .updateTour,
178
00:09:51,360 --> 00:09:53,173
createTour, getTour, and getAllTours.
179
00:09:54,840 --> 00:09:59,480
Okay, so that exports everything from this file.
180
00:09:59,480 --> 00:10:02,470
And so now, let's go into the tourRoutes,
181
00:10:02,470 --> 00:10:03,960
and simply import them.
182
00:10:03,960 --> 00:10:08,960
So const, tourController, equals require.
183
00:10:13,770 --> 00:10:18,360
Okay, now we're in the routes folder here, right?
184
00:10:18,360 --> 00:10:20,273
So we need to move up one level,
185
00:10:21,580 --> 00:10:23,853
and then go into controllers,
186
00:10:25,140 --> 00:10:28,333
and into the tourController.js.
187
00:10:30,290 --> 00:10:35,290
Okay, this is not correct, and alright.
188
00:10:35,290 --> 00:10:38,310
Now, remember that when we export data from a file
189
00:10:38,310 --> 00:10:40,810
using the exports object.
190
00:10:40,810 --> 00:10:42,840
So just like we did here.
191
00:10:42,840 --> 00:10:45,410
When we then import everything into one object,
192
00:10:45,410 --> 00:10:48,170
then all of the data that was on exports
193
00:10:48,170 --> 00:10:50,310
is now gonna be on tourController.
194
00:10:50,310 --> 00:10:54,289
And so we will have tourController.getAllTours
195
00:10:54,289 --> 00:10:56,830
.createTours.getTour,
196
00:10:56,830 --> 00:10:59,520
and really, all of these, okay?
197
00:10:59,520 --> 00:11:02,440
So this object here will be the equivalent
198
00:11:02,440 --> 00:11:05,500
of the exports that we have here.
199
00:11:05,500 --> 00:11:06,760
Remember that?
200
00:11:06,760 --> 00:11:08,420
And so, it's really simple.
201
00:11:08,420 --> 00:11:10,860
All I have to do now is to create
202
00:11:12,266 --> 00:11:17,266
tourController., and that's it.
203
00:11:17,290 --> 00:11:19,810
Now I could have also used the structuring,
204
00:11:19,810 --> 00:11:21,483
which I also showed you before.
205
00:11:22,930 --> 00:11:24,830
So just to demonstrate,
206
00:11:24,830 --> 00:11:26,680
I could have used it like this,
207
00:11:26,680 --> 00:11:31,220
and then specified the exact same names that we have here.
208
00:11:31,220 --> 00:11:36,220
So getAllTours, and then createTour, and all of these,
209
00:11:36,800 --> 00:11:38,570
and then I could have used them directly here
210
00:11:38,570 --> 00:11:42,160
without having to write tourController, and dot.
211
00:11:42,160 --> 00:11:44,370
Okay, but I actually like it like this,
212
00:11:44,370 --> 00:11:47,560
and I see no problem of having it like this.
213
00:11:47,560 --> 00:11:49,410
So it makes it nicely visible
214
00:11:49,410 --> 00:11:52,340
that all of these functions here actually come
215
00:11:52,340 --> 00:11:54,193
from this tourController module.
216
00:11:55,620 --> 00:12:00,620
Okay, so I saved it now, and so it should keep working,
217
00:12:00,940 --> 00:12:03,493
so let's test that, and yeah, it does.
218
00:12:06,486 --> 00:12:08,410
So, that's working now.
219
00:12:08,410 --> 00:12:13,410
Let's actually close it up, and now the same, where is it?
220
00:12:13,850 --> 00:12:14,683
Ah, here.
221
00:12:15,960 --> 00:12:18,243
Now the same of course with these functions.
222
00:12:19,730 --> 00:12:20,713
Put them here,
223
00:12:23,960 --> 00:12:26,423
and then export all these guys.
224
00:12:30,490 --> 00:12:31,463
So exports.
225
00:12:33,540 --> 00:12:36,070
Yeah, so that's correct.
226
00:12:36,070 --> 00:12:39,103
Now here, we just imported module,
227
00:12:46,180 --> 00:12:49,163
and the same as before, we need to move up one level.
228
00:12:50,290 --> 00:12:54,763
We go into controllers, and userController.
229
00:12:55,610 --> 00:12:57,963
Now finally, just add that here.
230
00:13:00,920 --> 00:13:05,760
Give it a save, and test it for this guy as well.
231
00:13:05,760 --> 00:13:07,860
And indeed, it works.
232
00:13:07,860 --> 00:13:11,020
So everything we did here was correct.
233
00:13:11,020 --> 00:13:13,810
So we're starting to have a bunch of files now,
234
00:13:13,810 --> 00:13:16,230
and so it's important to really get familiar,
235
00:13:16,230 --> 00:13:18,060
where exactly all the different pieces
236
00:13:18,060 --> 00:13:21,900
of the application are located, okay?
237
00:13:21,900 --> 00:13:25,110
So just to recap, the flow goes like this.
238
00:13:25,110 --> 00:13:29,840
We start receiving the request in the app.js file, right?
239
00:13:29,840 --> 00:13:31,540
It will then depending on the route
240
00:13:31,540 --> 00:13:34,870
enter one of the routers, so let's say the tour router,
241
00:13:34,870 --> 00:13:37,470
and then depending, again, on that route,
242
00:13:37,470 --> 00:13:40,620
and of the request, it will then execute
243
00:13:40,620 --> 00:13:42,750
one of these controllers here,
244
00:13:42,750 --> 00:13:46,280
and so these are in the tourController files.
245
00:13:46,280 --> 00:13:49,340
And that's where then finally the response gets sent,
246
00:13:49,340 --> 00:13:52,113
and finishing the request-response cycle.
247
00:13:53,000 --> 00:13:55,120
Okay, so we have now three files,
248
00:13:55,120 --> 00:13:57,950
instead of having everything just in one file.
249
00:13:57,950 --> 00:14:01,090
Alright, but that's still not the end of the story,
250
00:14:01,090 --> 00:14:03,070
because I'm adding one more step here.
251
00:14:03,070 --> 00:14:07,403
So what I'm gonna do is to create a server.js file as well.
252
00:14:09,840 --> 00:14:11,850
So server.js.
253
00:14:11,850 --> 00:14:14,090
And why am I doing that?
254
00:14:14,090 --> 00:14:16,620
Well, simply because it's a good practice
255
00:14:16,620 --> 00:14:21,000
to have everything that is related to express in one file,
256
00:14:21,000 --> 00:14:23,960
and then everything that is related to the server
257
00:14:23,960 --> 00:14:25,910
in another main file.
258
00:14:25,910 --> 00:14:29,800
So starting now, server.js will actually be
259
00:14:29,800 --> 00:14:32,460
our starting file where everything starts,
260
00:14:32,460 --> 00:14:35,163
and it's there when we listen to our server.
261
00:14:36,250 --> 00:14:40,360
So let's actually go ahead and copy, or cut,
262
00:14:40,360 --> 00:14:43,533
this part from here, and move it into the server.
263
00:14:44,400 --> 00:14:47,970
Now of course, this module here doesn't know about app,
264
00:14:47,970 --> 00:14:49,480
and so we need to import it.
265
00:14:49,480 --> 00:14:52,223
And to import it, we need to first export it.
266
00:14:53,290 --> 00:14:56,800
So we use module.exports,
267
00:14:56,800 --> 00:15:00,530
and we export our application from this file.
268
00:15:00,530 --> 00:15:02,700
Okay, and so now we have everything
269
00:15:02,700 --> 00:15:05,540
that is basically the application configuration
270
00:15:05,540 --> 00:15:07,193
in one standalone file.
271
00:15:08,080 --> 00:15:12,603
Okay, so back in the server, let's now import that.
272
00:15:16,210 --> 00:15:20,600
Require, and since it's our own module,
273
00:15:20,600 --> 00:15:23,590
we need to use this ./ to say
274
00:15:23,590 --> 00:15:25,323
that we're in the current folder,
275
00:15:26,210 --> 00:15:28,310
and here's it's simply app.
276
00:15:28,310 --> 00:15:29,870
So, simple as that.
277
00:15:29,870 --> 00:15:31,900
And later on we will actually have other stuff
278
00:15:31,900 --> 00:15:34,780
in this file that is not related to express,
279
00:15:34,780 --> 00:15:37,130
but still related to our application.
280
00:15:37,130 --> 00:15:39,590
So stuff like database configurations,
281
00:15:39,590 --> 00:15:43,350
or some error handling stuff, or environment variables,
282
00:15:43,350 --> 00:15:46,490
all of that stuff will live in this server.js,
283
00:15:46,490 --> 00:15:49,670
which is kind of our entry point, okay?
284
00:15:49,670 --> 00:15:52,730
So let's now finish the process that we have here,
285
00:15:52,730 --> 00:15:56,840
because now we do no longer run nodemon app.js,
286
00:15:56,840 --> 00:16:00,670
but instead, we need to run server.js.
287
00:16:00,670 --> 00:16:02,820
Okay, and actually since we're doing that,
288
00:16:02,820 --> 00:16:05,623
let me create an npm script for that.
289
00:16:07,200 --> 00:16:09,240
Closing that guy very quick.
290
00:16:09,240 --> 00:16:12,593
And so let me add here, npm start,
291
00:16:15,300 --> 00:16:19,090
nodemon server.js.
292
00:16:19,090 --> 00:16:22,420
Because this way, I no longer have to really know
293
00:16:22,420 --> 00:16:24,920
which is the file that I actually want to run.
294
00:16:24,920 --> 00:16:28,010
So all I have to write is npm start,
295
00:16:28,010 --> 00:16:30,430
and there's no doubt that it's gonna work.
296
00:16:30,430 --> 00:16:32,120
Otherwise, I might have to think,
297
00:16:32,120 --> 00:16:35,780
hm, is it app.js, or server.js, or what?
298
00:16:35,780 --> 00:16:37,360
What do we have to start here?
299
00:16:37,360 --> 00:16:39,350
But like this, I don't have to think,
300
00:16:39,350 --> 00:16:44,350
all I have to do is npm start, and it's gonna start.
301
00:16:45,340 --> 00:16:48,200
Okay, so just like this,
302
00:16:48,200 --> 00:16:50,450
and here we are back running our application.
303
00:16:51,810 --> 00:16:54,590
Close that guy, and by the way, this works,
304
00:16:54,590 --> 00:16:57,400
even without having nodemon installed
305
00:16:57,400 --> 00:16:58,860
as our dev dependency,
306
00:16:58,860 --> 00:17:01,410
because I have nodemon installed globally.
307
00:17:01,410 --> 00:17:03,200
So we did that in the first section,
308
00:17:03,200 --> 00:17:05,640
and hopefully you did it there as well.
309
00:17:05,640 --> 00:17:09,390
If not, then go ahead and in another tab
310
00:17:09,390 --> 00:17:14,140
do npm install nodemon,
311
00:17:14,140 --> 00:17:17,119
so if for some reason you skipped that section,
312
00:17:17,119 --> 00:17:19,609
you type npm install nodemon,
313
00:17:19,609 --> 00:17:23,589
and then you can either install it globally like this,
314
00:17:23,589 --> 00:17:26,083
or you can install it as a dev dependency,
315
00:17:27,810 --> 00:17:29,680
like this, alright?
316
00:17:29,680 --> 00:17:31,900
So just make sure that you have nodemon installed,
317
00:17:31,900 --> 00:17:35,293
no matter if it's globally or as a dev dependency,
318
00:17:36,700 --> 00:17:38,963
okay, in order to make this work.
319
00:17:40,370 --> 00:17:43,053
So final check, just to make sure,
320
00:17:44,250 --> 00:17:48,350
and want this one, and yeah, indeed.
321
00:17:48,350 --> 00:17:51,330
We have our app correctly refactored.
322
00:17:51,330 --> 00:17:55,440
So these were a lot of changes in one video alone,
323
00:17:55,440 --> 00:17:57,470
so after you finish this one,
324
00:17:57,470 --> 00:18:00,830
please go ahead and analyze everything that we did
325
00:18:00,830 --> 00:18:03,420
and really try to trace a path
326
00:18:03,420 --> 00:18:06,510
that a request will do inside of our app
327
00:18:06,510 --> 00:18:07,880
from start to finish.
328
00:18:07,880 --> 00:18:09,650
This way you will really get a feeling
329
00:18:09,650 --> 00:18:11,650
of how everything here works.
330
00:18:11,650 --> 00:18:14,863
And I'll see you after doing that in the next video.
25499
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.