Skip to content

Commit 0904f15

Browse files
committed
feat: cors -에러 해결
1 parent 98d3bb6 commit 0904f15

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main.ts

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ async function bootstrap() {
88
const app = await NestFactory.create(AppModule);
99
app.useGlobalFilters(new ServiceExceptionToHttpExceptionFilter());
1010
app.useGlobalPipes(new ValidationPipe());
11+
app.enableCors({
12+
origin: [
13+
'http://localhost:3000',
14+
'https://oodd.today',
15+
'https://dev.oodd.today',
16+
], // 프론트엔드에서 접근 가능한 도메인
17+
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
18+
credentials: true,
19+
});
1120
setupSwagger(app);
1221
await app.listen(process.env.PORT);
1322
console.log(`Application is running on: ${await app.getUrl()}`);

0 commit comments

Comments
 (0)