From da564323a0d7fbea4ee4acf8c8ec356e68a6bd9d Mon Sep 17 00:00:00 2001 From: danny-mhlv Date: Tue, 16 Aug 2022 16:57:56 +0300 Subject: [PATCH] Added versioning for the /papers controller --- src/application/controller/papers.controller.ts | 5 ++++- src/main.ts | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/application/controller/papers.controller.ts b/src/application/controller/papers.controller.ts index a251822..4aefece 100644 --- a/src/application/controller/papers.controller.ts +++ b/src/application/controller/papers.controller.ts @@ -8,7 +8,10 @@ import { RequestDto } from "src/core/domain/dtos/request.dto"; /** * /papers/ route controller */ -@Controller('papers') +@Controller({ + version: '1', + path: 'papers', +}) export class PapersController { constructor(private searchService: SearchService) {} diff --git a/src/main.ts b/src/main.ts index 5333fdb..4d8d5c2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,5 @@ import morgan from 'morgan'; -import { Logger, ValidationPipe } from '@nestjs/common'; +import { Logger, ValidationPipe, VersioningType } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { AppModule } from './infrastructure/modules/app.module'; import { SwaggerModule, DocumentBuilder, SwaggerDocumentOptions } from '@nestjs/swagger'; @@ -19,6 +19,10 @@ async function bootstrap() { }) ); + app.enableVersioning({ + type: VersioningType.URI, + }); + /** * Configuration of the Swagger document */