음.. 아주 단순한 오류였다.
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { FRONTEND_URL, PORT } from './common/config/env.config';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(`${PORT}`);
app.enableCors({
origin: FRONTEND_URL,
credentials: true,
});
}
bootstrap();
port listen보다 CORS 설정이 밑이라 적용이 안됐다.
localhost 3000, 8080끼리 통신인데 왜 CORS가 뜨지 했는데 다시 보니 위 코드처럼 써놨다..
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { FRONTEND_URL, PORT } from './common/config/env.config';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.enableCors({
origin: FRONTEND_URL,
credentials: true,
});
await app.listen(`${PORT}`); // bootstrap 가장 아래로..
}
bootstrap();
아무리 신나도 이런 실수는 다시 하지 않기로..