Hi everyone.
In this video I will set up the Nest.js project.
Okay, to understand the fundamentals and the core concept of Nest.js.
Now let's go to the nestjs.com
And click on the documentation okay.
The documentation of nestJS is very good.
So for that reason I will use the documentation.
I'll show you the core concept of NestJS.
Firstly scroll down to installation right here.
And firstly, we will.
Copy the NestJS CLI right here.
Okay.
You can open the terminal and paste it.
And wait is a little bit.
Okay.
I already installed so I will stop it right now.
And in order to create the project we use the nest new and project name right here.
Okay.
So for that reason I will open the folder right here and I will open the terminal and I will write.
Nest new.
Nest js tutorial.
Okay.
And later I will have a project for building the real world application.
Let's enter.
Okay.
And wait a little bit.
Different.
And in this score I will use the npm.
Okay.
We can use the yarn or the pnpm if you want.
And I will use the npm.
Okay.
I will enter that.
And after successfully creating this project, I will go to the project using CD Nestjs tutorial and
open the Visual Studio Code.
Okay, this is the project we have in the root.
We have a src and test right here.
And the test right here will be for end to end testing.
And actually I will not discuss into the test in this course.
Maybe in the later I will create another course for showing the testing driven development.
Okay.
But in this course I will not discuss the test.
And firstly we have something called controller.spec.ts.
Right.
This spec right here is a test thing.
And for that reason I will remove that.
I will not discuss the testing right here.
So I will remove the test folder also.
And we have a controller module app and main.ts.
And firstly let me show you how to run the project first.
Inside the package.json, right here, we have a start.
Start dev and start:debug and start:production.
Okay.
We will focus on the start:dev right here.
Okay.
And let me run that.
NPM run start colon dev.
with run with the dev mode right here.
It will watch the any file changes.
Okay.
If we have any file changes it will auto restart the terminal.
And let wait a little bit.
Okay.
When when you say the applications are fully started, we will go to the main.ts and see this is
port of the application, right?
So 3000.
For that reason I will go to the localhost 3000 and you can see this is the hello world right.
And this is the project of Nest.js.
And I will discuss about what is the controller module and service it in later.
Don't worry about that for now.
And in this video let's focus on the main.ts.
When we run the project it will run the bootstrap function right here.
Okay.
It will bootstrap the application and it will create the.
The app module.
Actually, the app module is right here.
I will discuss about the module in later.
Don't worry about us and we will listen on port 3000 right here to run the application.
And for that reason we will have something right here.
Now, you may, uh, you may want to know where is the hello World come from?
Actually, when we run the app module, let me go to the app module in app module right here we have a
controller.
Okay.
We have a controller.
And let me ctrl click into the app controller.
Okay.
In the app controller we have a get methods.
This is the method I will discuss deeply about that later.
So this is a Get method.
Methods and with the get method we have a get.
Hello.
Right here.
It will return a string.
Right?
It will return a string.
And the string right.
Here it comes from the service get hello.
Hello.
Let me control.
Click into the get hello right here in the app.service.ts.
We know that it will return the hello world right.
For that reason you will see the Hello World right here.
And we can change about that.
We can chain it will reload.
Okay.
It will reload and we will refresh.
So it will show the change.
And that's it.
The structure.
Okay.
We usually work inside the src folder.
And one, one more folder will be the dist.
Now let me briefly about what is dist folders.
Actually dist folder right here is a "build" right here.
When we build the project it will convert everything from the src folder.
If you convert it into the JS right here.
Now you can see this is the dot js extension right.
Because the TypeScript is just a compiler okay.
Later it will convert the TypeScript into the JavaScript.
Thank to the ts config ts dot config file right here.
And that is that's for the video.
I will see you in the next one.