WEBVTT

00:00.980 --> 00:02.660
Hi everyone.

00:03.470 --> 00:08.270
In this video I will set up the Nest.js project.

00:10.460 --> 00:15.740
Okay, to understand the fundamentals and the core concept of Nest.js.

00:17.450 --> 00:20.000
Now let's go to the nestjs.com

00:22.550 --> 00:26.840
And click on the documentation okay.

00:26.960 --> 00:30.620
The documentation of nestJS is very good.

00:30.800 --> 00:34.820
So for that reason I will use the documentation.

00:34.850 --> 00:39.860
I'll show you the core concept of NestJS.

00:41.090 --> 00:46.940
Firstly scroll down to installation right here.

00:47.360 --> 00:50.000
And firstly, we will.

00:52.670 --> 00:56.720
Copy the NestJS CLI right here.

00:59.960 --> 01:00.320
Okay.

01:00.320 --> 01:04.460
You can open the terminal and paste it.

01:07.340 --> 01:09.080
And wait is a little bit.

01:09.380 --> 01:09.830
Okay.

01:11.150 --> 01:16.670
I already installed so I will stop it right now.

01:18.590 --> 01:26.570
And in order to create the project we use the nest new and project name right here.

01:27.620 --> 01:28.160
Okay.

01:28.220 --> 01:37.820
So for that reason I will open the folder right here and I will open the terminal and I will write.

01:37.850 --> 01:39.050
Nest new.

01:40.100 --> 01:43.010
Nest js tutorial.

01:44.780 --> 01:45.200
Okay.

01:45.200 --> 01:51.170
And later I will have a project for building the real world application.

01:54.890 --> 01:56.030
Let's enter.

01:59.630 --> 02:00.050
Okay.

02:00.050 --> 02:01.310
And wait a little bit.

02:21.690 --> 02:21.900
Different.

02:22.380 --> 02:26.010
And in this score I will use the npm.

02:26.040 --> 02:26.700
Okay.

02:26.760 --> 02:30.870
We can use the yarn or the pnpm if you want.

02:31.980 --> 02:33.930
And I will use the npm.

02:33.960 --> 02:34.470
Okay.

02:34.500 --> 02:35.430
I will enter that.

03:31.110 --> 03:43.980
And after successfully creating this project, I will go to the project using CD Nestjs tutorial and

03:43.980 --> 03:45.900
open the Visual Studio Code.

03:51.420 --> 03:56.220
Okay, this is the project we have in the root.

03:56.250 --> 04:00.270
We have a src and test right here.

04:00.660 --> 04:04.270
And the test right here will be for end to end testing.

04:04.930 --> 04:12.730
And actually I will not discuss into the test in this course.

04:13.060 --> 04:22.840
Maybe in the later I will create another course for showing the testing driven development.

04:24.190 --> 04:24.610
Okay.

04:25.780 --> 04:28.570
But in this course I will not discuss the test.

04:29.590 --> 04:35.830
And firstly we have something called controller.spec.ts.

04:37.210 --> 04:37.690
Right.

04:37.870 --> 04:42.280
This spec right here is a test thing.

04:43.630 --> 04:46.300
And for that reason I will remove that.

04:46.750 --> 04:49.840
I will not discuss the testing right here.

04:49.840 --> 04:54.010
So I will remove the test folder also.

04:55.180 --> 05:00.490
And we have a controller module app and main.ts.

05:00.820 --> 05:04.660
And firstly let me show you how to run the project first.

05:04.810 --> 05:09.880
Inside the package.json, right here, we have a start.

05:09.910 --> 05:13.390
Start dev and start:debug and start:production.

05:13.990 --> 05:14.440
Okay.

05:14.530 --> 05:17.980
We will focus on the start:dev right here.

05:18.250 --> 05:18.850
Okay.

05:20.620 --> 05:21.910
And let me run that.

05:25.570 --> 05:29.410
NPM run start colon dev.

05:33.010 --> 05:39.250
with run with the dev mode right here.

05:39.250 --> 05:42.790
It will watch the any file changes.

05:43.450 --> 05:43.810
Okay.

05:43.840 --> 05:50.500
If we have any file changes it will auto restart the terminal.

05:55.780 --> 05:57.250
And let wait a little bit.

06:01.510 --> 06:01.960
Okay.

06:01.960 --> 06:14.170
When when you say the applications are fully started, we will go to the main.ts and see this is

06:14.170 --> 06:16.900
port of the application, right?

06:17.650 --> 06:19.960
So 3000.

06:19.990 --> 06:29.650
For that reason I will go to the localhost 3000 and you can see this is the hello world right.

06:30.730 --> 06:34.090
And this is the project of Nest.js.

06:34.360 --> 06:41.200
And I will discuss about what is the controller module and service it in later.

06:43.120 --> 06:45.730
Don't worry about that for now.

06:47.050 --> 06:50.170
And in this video let's focus on the main.ts.

06:50.230 --> 06:54.850
When we run the project it will run the bootstrap function right here.

06:55.690 --> 06:56.110
Okay.

06:56.140 --> 07:02.290
It will bootstrap the application and it will create the.

07:04.880 --> 07:05.810
The app module.

07:05.840 --> 07:08.810
Actually, the app module is right here.

07:11.180 --> 07:14.480
I will discuss about the module in later.

07:14.510 --> 07:25.520
Don't worry about us and we will listen on port 3000 right here to run the application.

07:25.520 --> 07:29.330
And for that reason we will have something right here.

07:29.390 --> 07:36.920
Now, you may, uh, you may want to know where is the hello World come from?

07:37.430 --> 07:45.770
Actually, when we run the app module, let me go to the app module in app module right here we have a

07:45.770 --> 07:46.670
controller.

07:47.300 --> 07:47.720
Okay.

07:47.750 --> 07:49.190
We have a controller.

07:49.550 --> 07:53.060
And let me ctrl click into the app controller.

07:53.750 --> 07:54.080
Okay.

07:54.110 --> 07:56.330
In the app controller we have a get methods.

07:56.360 --> 08:01.100
This is the method I will discuss deeply about that later.

08:01.430 --> 08:03.260
So this is a Get method.

08:03.260 --> 08:07.790
Methods and with the get method we have a get.

08:07.820 --> 08:08.330
Hello.

08:08.390 --> 08:09.170
Right here.

08:09.170 --> 08:10.700
It will return a string.

08:11.480 --> 08:11.990
Right?

08:12.350 --> 08:13.490
It will return a string.

08:13.880 --> 08:15.350
And the string right.

08:15.380 --> 08:18.290
Here it comes from the service get hello.

08:18.320 --> 08:18.920
Hello.

08:19.520 --> 08:20.480
Let me control.

08:20.480 --> 08:23.210
Click into the get hello right here in the app.service.ts.

08:23.540 --> 08:26.930
We know that it will return the hello world right.

08:26.960 --> 08:31.370
For that reason you will see the Hello World right here.

08:31.580 --> 08:33.590
And we can change about that.

08:33.680 --> 08:38.330
We can chain it will reload.

08:39.560 --> 08:39.920
Okay.

08:39.920 --> 08:42.440
It will reload and we will refresh.

08:43.400 --> 08:47.390
So it will show the change.

08:49.880 --> 08:50.870
And that's it.

08:50.870 --> 08:51.950
The structure.

08:55.430 --> 08:55.940
Okay.

08:55.970 --> 09:02.900
We usually work inside the src folder.

09:02.900 --> 09:05.370
And one, one more folder will be the dist.

09:07.590 --> 09:11.400
Now let me briefly about what is dist folders.

09:11.970 --> 09:18.030
Actually dist folder right here is a "build" right here.

09:18.270 --> 09:27.060
When we build the project it will convert everything from the src folder.

09:27.090 --> 09:31.620
If you convert it into the JS right here.

09:31.770 --> 09:37.050
Now you can see this is the dot js extension right.

09:37.170 --> 09:42.630
Because the TypeScript is just a compiler okay.

09:42.690 --> 09:48.450
Later it will convert the TypeScript into the JavaScript.

09:49.350 --> 09:53.970
Thank to the ts config ts dot config file right here.

09:57.060 --> 10:01.500
And that is that's for the video.

10:01.530 --> 10:03.510
I will see you in the next one.
