From 79e5304d4b669cafbf18d21f6ab920da6aa0178c Mon Sep 17 00:00:00 2001 From: elvis-ndubuisi Date: Sat, 2 Mar 2024 12:08:05 +0100 Subject: [PATCH] perf: add cors to endpoints --- .commitlintrc | 0 apps/server/src/app.controller.ts | 2 +- apps/server/src/main.ts | 3 +++ 3 files changed, 4 insertions(+), 1 deletion(-) delete mode 100644 .commitlintrc diff --git a/.commitlintrc b/.commitlintrc deleted file mode 100644 index e69de29..0000000 diff --git a/apps/server/src/app.controller.ts b/apps/server/src/app.controller.ts index 96072ca..dfa6c4d 100644 --- a/apps/server/src/app.controller.ts +++ b/apps/server/src/app.controller.ts @@ -1,7 +1,7 @@ import { Controller, Get } from "@nestjs/common"; import { AppService } from "./app.service"; -@Controller() +@Controller({ version: "1" }) export class AppController { constructor(private readonly appService: AppService) {} diff --git a/apps/server/src/main.ts b/apps/server/src/main.ts index 92a6fbc..898c368 100644 --- a/apps/server/src/main.ts +++ b/apps/server/src/main.ts @@ -1,8 +1,11 @@ import { NestFactory } from "@nestjs/core"; import { AppModule } from "./app.module"; +import { VersioningType } from "@nestjs/common"; async function bootstrap() { const app = await NestFactory.create(AppModule); + app.enableCors(); + app.enableVersioning({ type: VersioningType.URI }); await app.listen(3000); } bootstrap();