Hi everyone.
Right now we already have a post and user.
Okay.
And let me show you how we can.
Create a swagger UI for this project.
Okay, so what is swagger. Swagger is just similar with the postman.
Okay but it's the website version and if you want to do that, you can feel free to do that with NestJS.
Okay.
Now let's click on the open api and click on the introduction.
And firstly, make sure we install this package okay.
This is the package. I'll open here.
And I will install the package.
And while it's being install I will show you, inside the bootstrap application main.ts.
We will use something like this code okay.
And to be honest I don't know what does it mean?
Okay.
So the first one is just needs to copy & paste and see what is that.
And after that we will modify later.
Okay.
Don't try to understand everything right now.
Let me import the document builder and also swagger module.
Okay.
That is and let me show you how it can be used.
If I scroll down if I run the project it will create something called localhost:3000/api.
Okay.
We will we can access into the URL right here.
If I access, now we have something called swagger UI right.
And this you can see, this is similar with the postman right? Now
Let me rename it a little bit right here.
For example like "Cats example" I will rename to NestJS
Tutorial okay.
And here we will NestJS description.
let me refresh right now okay.
We already changed and "cats" right here is the the "tag"
And I will show you what is the "tag" later.
Don't worry about them. Firstly
Let me remove the addTag right here
And one more thing.
How we can change the URL for example I don't want it use the /api
And I want you to swagger.
For example.
Like that. In order to do that, we can change right here inside the setup.
We can change the URL to swagger like that, and let refresh
And now if I refresh right here, now this also works, right?
And now because we have an app module right here, and we have an app controller with the get method.
So it will create it will group the endpoint for me
Okay.
And one more thing.
For example I will create one more controller inside the user.
Okay.
Let me open the post right here.
And.
Now let me copy everything inside the post controller and paste inside the user controller.
Okay.
Now I will rename a little bit.
I will name to.
Here will be the users and here will be the user controller
Okay.
We can
I think we don't need
all of that
Okay, let me remove something.
Okay.
I just need to use the @Post and @Get
And let me remove thing right now.
We can use the CreatePostDTO if you want.
And right here, we don't need the post server
And right here, post.
Here will be get.
Okay, I will do that simple like this.
And now let's see what happens right now. If
I refresh.
Now it will create one more group of a user for me, right?
Very cool.
And.
I think that's enough for the video, so I will see you in the next one.