📝 add addBearerAuth swagger
This commit is contained in:
parent
93127d2bd6
commit
d32239e53a
@ -1,7 +1,7 @@
|
|||||||
import { Body, Controller, Get, Post } from '@nestjs/common'
|
import { Body, Controller, Get, Post } from '@nestjs/common'
|
||||||
import { AuthService } from './auth.service'
|
import { AuthService } from './auth.service'
|
||||||
import { CreateUserDto } from 'src/users/dto/create-user.dto'
|
import { CreateUserDto } from 'src/users/dto/create-user.dto'
|
||||||
import { ApiTags } from '@nestjs/swagger'
|
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger'
|
||||||
import { LoginInputDto } from './dto/login-input.dto'
|
import { LoginInputDto } from './dto/login-input.dto'
|
||||||
import { UserEntity } from 'src/users/entities/user.entity'
|
import { UserEntity } from 'src/users/entities/user.entity'
|
||||||
import { User } from 'src/common/decorators/user.decorator'
|
import { User } from 'src/common/decorators/user.decorator'
|
||||||
@ -24,6 +24,7 @@ export class AuthController {
|
|||||||
return this.authService.login(user.email, user.password)
|
return this.authService.login(user.email, user.password)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiBearerAuth()
|
||||||
@Get('api/profile')
|
@Get('api/profile')
|
||||||
async getUserInfo(@User() user: UserEntity) {
|
async getUserInfo(@User() user: UserEntity) {
|
||||||
return user
|
return user
|
||||||
|
@ -21,6 +21,7 @@ async function bootstrap() {
|
|||||||
|
|
||||||
// Swagger Api
|
// Swagger Api
|
||||||
const options = new DocumentBuilder()
|
const options = new DocumentBuilder()
|
||||||
|
.addBearerAuth()
|
||||||
.setTitle('Nest Project')
|
.setTitle('Nest Project')
|
||||||
.setDescription('The Nest-Project API description')
|
.setDescription('The Nest-Project API description')
|
||||||
.setVersion('1.0')
|
.setVersion('1.0')
|
||||||
|
Loading…
Reference in New Issue
Block a user