Hi everyone.
In this video let's discuss about.
Nest CLI, command line interface okay.
In the nestjs documentation inside the CLI command line interface right here click on overview.
Actually in the beginning of this course we already installed the nestjs.
CLI right here.
If you click on the introduction right here we can we already installed that right.
And thank to install the NestJS
CLI, we can create with the "nest"
And new project name right here okay.
The CLI is just a tool to make the developer life easier
to work
Okay.
Now firstly let me click on the usage right here.
You can read more about something right here if you want.
If I click on the usage, it have some command line, for "nest new" or "nest n" for shorthand to create
the project.
Okay, we already see it in the beginning of the course, and if I scroll down a little bit, it has a
something called "nest generate"
It will generate with some semantics.
Okay.
We can use generate or shorthand like "g".
Okay.
With the same schematic and name.
Now let's see what is schematic.
If you scroll down into the schematics.
Right here, we can see it can generate something like "app library class controller".
Right.
Middleware module.
Or service.
Now let me show you how we can do that.
Firstly I think I will remove everything right here.
Okay.
Remove everything and go back with default one.
For example, if I want to create the folder and we have a post controller, post module and post service
we'll not do that by hand like the first section, because right now we already have a.
Nest CLI
Firstly, let me remove the module right here.
I think that will clean up.
A bit.
Module.
Okay.
And now firstly, I will use the net.
"nest g"
nest generate and schematic
I will firstly I will create a module first.
Okay.
Because the module is very important in NestJS.
I will call the "post".
For example like this.
Now you can see, what happened right now.
Well, if it's not working in your case, you can try, you can add the prefix.
"npx" right now.
Okay.
And this next generate module and post.
Let me enter.
And let wait a bit.
Now you can see, it already create.
At the same time and will update the app module.
Now let me see what actually inside the app module.
But let's look at the post, in the post.
We already have something called "PostModule" like this.
Very cool
Right?
And inside the app module it will auto import the "PostModule" inside the import statement.
Okay, so that's it.
Now let me create something like controller.
Firstly, I think I will create a service first.
Okay.
It will.
Auto provider.
Okay.
It will auto injection.
You can see, if I clicked on the "PostService" right here, it will auto mark the "@Injectable"
To the IOC container manage the "PostService" right.
And it also.
Add inside the providers.
We already discussed in the first section.
And now I will create a controller.
Okay.
We also have a controller like this right.
Very cool.
And the controller here is auto mark with the "post"
Now I will discuss what is the "post" inside the controller right here in later.
Don't worry about that, but let me remove the "spect"file for unit test.
Okay.
That is that for the command line user interface
And when you work with the NestJS, we should use the command line interface, in the options
we have a something option.
If I scroll down to the option right here, we can see, if we don't want it auto generate the unit test.
You can use the flag right here.
I will show you how we can do that later.
Okay.
So that's it, we can read more about the different topics over here.
But for now this is enough for the project.
I will see you in the next one.