HM-110. Научили свагер работать с токенами

This commit is contained in:
vigdorov
2020-08-10 20:51:58 +03:00
parent f0100ba084
commit 850cfb7ec0
2 changed files with 8 additions and 2 deletions

View File

@ -33,6 +33,11 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
const options = new DocumentBuilder() const options = new DocumentBuilder()
.addSecurity('apiKey', {
type: 'apiKey',
in: 'header',
name: 'Authorization',
})
.setTitle('Auth API') .setTitle('Auth API')
.setDescription('API для авторизации приложений и работы с пользователями') .setDescription('API для авторизации приложений и работы с пользователями')
.setVersion('1.0.0') .setVersion('1.0.0')

View File

@ -1,6 +1,6 @@
import {Controller, Get, Req, Post, Options, Header, Delete, HttpCode, Put} from '@nestjs/common'; import {Controller, Get, Req, Post, Options, Header, Delete, HttpCode, Put} from '@nestjs/common';
import {ApiResponse, ApiTags, ApiParam, ApiBody} from '@nestjs/swagger'; import {ApiResponse, ApiTags, ApiParam, ApiBody, ApiSecurity} from '@nestjs/swagger';
import { import {
ALLOW_ORIGIN_ALL, ALLOW_ORIGIN_ALL,
ALLOW_METHOD, ALLOW_METHOD,
@ -37,6 +37,7 @@ import {
} from './users.responses'; } from './users.responses';
import {AuthService} from 'src/auth/auth.service'; import {AuthService} from 'src/auth/auth.service';
@ApiSecurity('apiKey')
@Controller(USERS_CONTROLLER) @Controller(USERS_CONTROLLER)
@ApiTags(USERS_CONTROLLER) @ApiTags(USERS_CONTROLLER)
export class UsersController { export class UsersController {