nishimura.clubnishimura.club

Nest.js CORS の設定

作成日
2021-10-01
更新日
2021-10-02
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();

CORS | NestJS - A progressive Node.js framework

Related

Tags

NestJS

Share