Creating API documentation in NestJS
@ApiTags('Booking')
:
Groups endpoints under the ‘Booking’ tag in the Swagger UI.
@ApiBearerAuth('JWT')
:
Indicates that this route requires JWT bearer authentication.
@Controller('bookings')
:
Defines a controller with a base route of ‘/bookings’.
@ApiCreatedResponse
, @ApiForbiddenResponse
:
Describe the possible responses that the endpoint could return. @ApiCreatedResponse
is used for successful responses, while @ApiForbiddenResponse
is used for forbidden responses.
@ApiOperation
:
Provides additional information about the operation such as a summary.
@Get('/me')
:
Defines a GET route on the path ‘/bookings/me’.