Skip to content

Commit

Permalink
Merge pull request #46 from JuribaDev/hotfix
Browse files Browse the repository at this point in the history
enable cors
  • Loading branch information
JuribaDev authored Sep 1, 2024
2 parents 4933b5d + 2506594 commit 0581587
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions apps/server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import mongoose from 'mongoose';
import { ORIGINS } from './shared/origins';

async function bootstrap() {
const app = await NestFactory.create(AppModule, {logger: ['error', 'warn', 'log','fatal']});
const app = await NestFactory.create(AppModule, {logger: ['error', 'warn', 'log','fatal'], cors: true});
app.useGlobalPipes(new ValidationPipe({
whitelist: true,
forbidNonWhitelisted: true,
Expand All @@ -20,12 +20,7 @@ async function bootstrap() {
return new BadRequestException(result);
},
}));
app.enableCors({
origin: ORIGINS,
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization'],
credentials: true,
});
app.enableCors();

const globalPrefix = 'api/v1';
app.setGlobalPrefix(globalPrefix);
Expand Down

0 comments on commit 0581587

Please sign in to comment.