From 86c531d61e7724bdf9923d98d1a49fd1c2f80e57 Mon Sep 17 00:00:00 2001 From: Anthony Mineo Date: Sat, 29 Aug 2020 19:32:50 -0400 Subject: [PATCH] Enable cors --- app/api/src/game/game.service.ts | 1 - app/api/src/main.ts | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/api/src/game/game.service.ts b/app/api/src/game/game.service.ts index aa981ef..00cc961 100644 --- a/app/api/src/game/game.service.ts +++ b/app/api/src/game/game.service.ts @@ -66,7 +66,6 @@ export class GameService { game.teams.obs.score += totalFlagScore; game.teams.obs.players.push(p); } - console.log(player.stats.dtTeamGame); } //const teamZero: any = game; //game.find(({ stats }) => stats.dtTeamGame[0] === '3'); diff --git a/app/api/src/main.ts b/app/api/src/main.ts index 03b1245..12e2664 100644 --- a/app/api/src/main.ts +++ b/app/api/src/main.ts @@ -7,6 +7,11 @@ import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule); + app.enableCors({ + origin: [ /\.localhost$/, /\.playt2\.com$/ ], + credentials: true + }); + app.useGlobalPipes( new ValidationPipe({ whitelist: true, @@ -27,7 +32,7 @@ async function bootstrap() { .build(); const document = SwaggerModule.createDocument(app, swaggerOptions); - SwaggerModule.setup('api', app, document); + SwaggerModule.setup('docs', app, document); await app.listen(3000); }