WEBVTT

1
00:00.620 --> 00:05.960
Now let's continue with the core concept of Nest.js.

2
00:07.580 --> 00:10.040
The next thing will be the modules.

3
00:10.610 --> 00:11.210
Okay.

4
00:11.930 --> 00:12.980
Let's click on that.

5
00:13.610 --> 00:17.510
And now what is the modules?

6
00:18.020 --> 00:24.980
The whole purpose of the module is to help you organize the application structure.

7
00:26.450 --> 00:26.930
Okay.

8
00:27.410 --> 00:37.190
Now for example I have some API for the e-commerce website for example like that okay.

9
00:37.310 --> 00:46.070
We will have a many modules like user module, order modules and chat module okay.

10
00:46.070 --> 00:53.240
We will organize that in the something called modules okay.

11
00:53.270 --> 00:55.160
That is the module.

12
00:57.080 --> 01:00.600
And now you can see the rule of the module.

13
01:01.110 --> 01:06.450
Each application has at least one module with a root module.

14
01:06.570 --> 01:07.170
Okay.

15
01:09.330 --> 01:11.040
And what is the root module?

16
01:11.970 --> 01:16.500
Actually the app module right here is the root module right.

17
01:16.650 --> 01:24.030
The reason is the root module because it does not depend on other modules.

18
01:25.050 --> 01:29.850
You can say you can see right here this is the top level module right.

19
01:30.150 --> 01:33.540
This is not depend on something module.

20
01:34.140 --> 01:34.680
Right.

21
01:35.280 --> 01:39.120
And for that reason this will be just the root module.

22
01:39.120 --> 01:42.270
And it will use the bootstrap application.

23
01:42.330 --> 01:43.350
You can see.

24
01:45.810 --> 01:51.690
And now let me discuss about some properties inside the module.

25
01:51.720 --> 01:52.770
Like

26
01:54.870 --> 01:56.070
Inside the module.

27
01:57.420 --> 02:00.400
It has a provider controller.

28
02:00.430 --> 02:02.170
Imports and exports.

29
02:02.800 --> 02:09.730
You can see inside the app module it has an imports controller, providers.

30
02:09.730 --> 02:10.390
Right.

31
02:10.390 --> 02:12.280
And it also has an export.

32
02:14.830 --> 02:21.790
And right now we already know what is the provider and what is the controller.

33
02:21.790 --> 02:22.420
Right.

34
02:24.190 --> 02:30.820
The provider you will be for the dependency injection of the NestJS

35
02:33.970 --> 02:38.620
And the controller we will register some controller inside here.

36
02:38.740 --> 02:39.700
Inside the controller.

37
02:39.700 --> 02:40.030
Array

38
02:41.980 --> 02:49.360
And we haven't yet discussed about what is import and what is export, right?.

39
02:50.350 --> 02:56.230
And I will discuss this later because we will use this a lot.

40
02:56.550 --> 02:56.970
Okay.

41
02:56.970 --> 02:58.620
This is very important.

42
03:03.600 --> 03:05.280
And let me scroll down.

43
03:06.330 --> 03:09.570
You can read more about us inside the Nest.js.

44
03:09.900 --> 03:10.440
Okay.

45
03:14.100 --> 03:17.040
And we can organize the code in some way.

46
03:17.040 --> 03:25.470
For example, in src folder, I have inside the root of the src, we have an

47
03:25.470 --> 03:27.300
app module and main.ts.

48
03:27.330 --> 03:27.870
Right.

49
03:28.380 --> 03:36.750
But we can organize that in some folder structure like class and controller module service.

50
03:36.780 --> 03:37.560
Right.

51
03:38.580 --> 03:42.060
And I will discuss what is the DTO and the interface later.

52
03:42.630 --> 03:44.430
Don't worry about that right now.

53
03:45.240 --> 03:50.820
And share module actually the import and export right here.

54
03:51.750 --> 03:54.690
Now the import and export right here.

55
03:54.690 --> 03:58.690
is used for the share module.

56
03:58.990 --> 04:01.060
I will discuss that later.

57
04:05.980 --> 04:08.050
Let me see how something like this.

58
04:09.160 --> 04:09.490
Okay.

59
04:09.490 --> 04:11.320
We can import and export.

60
04:11.770 --> 04:14.080
I will discuss that, don't worry.

61
04:17.110 --> 04:20.950
Now you can see, we already know the provider, right?

62
04:21.130 --> 04:23.050
It used for dependency injection.

63
04:26.380 --> 04:26.800
Okay.

64
04:26.830 --> 04:28.990
And global global module.

65
04:29.170 --> 04:31.180
We can use something like this.

66
04:32.410 --> 04:34.690
You can read more about that right here.

67
04:35.140 --> 04:35.470
Okay.

68
04:35.500 --> 04:39.220
Anyway that is the module.

69
04:39.760 --> 04:45.040
And it just organize the application structure.

70
04:45.040 --> 04:51.460
And in the next video I will show you how to create the module in NestJS.

71
04:51.550 --> 04:53.500
I will see you in the next one.