import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { ConfigService } from '@nestjs/config'; async function bootstrap() { const app = await NestFactory.create(AppModule); const configService = app.get(ConfigService); app.enableCors({ origin: '*', allowedHeaders: 'Origin, X-Requested-With, Content-Type, Accept', }); // or // app.enableCors(); await app.listen(configService.get('port')); } bootstrap();