Skip to content

Commit

Permalink
Add CORS setting
Browse files Browse the repository at this point in the history
  • Loading branch information
version-1 committed Feb 20, 2024
1 parent 479cdda commit ad77667
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ import { ConfigService } from '@nestjs/config';
import cookieParser from 'cookie-parser';
import { AppModule } from './app.module';

const origin = [process.env.ALLOW_REQUEST_URL || 'http://localhost:3000'];

console.log('CORS Setting / ORIGIN: ', origin);

async function bootstrap() {
const api = await NestFactory.create(AppModule, {
cors: {
origin: ['http://localhost:3000'],
origin,
methods: ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'],
allowedHeaders: [
'Origin',
Expand Down

0 comments on commit ad77667

Please sign in to comment.