NestJS enable cors in production

前端 未结 5 1232
萌比男神i
萌比男神i 2021-02-03 21:49

I\'ve enabled CORS in my NestJS app following the official tutorial, so my main.ts looks like the following:

import { FastifyAdapter, NestFactory }          


        
5条回答
  •  既然无缘
    2021-02-03 22:10

    Try to use an approach described in here https://docs.nestjs.com/techniques/security#cors

    const app = await NestFactory.create(ApplicationModule);
    app.enableCors();
    await app.listen(3000);
    

提交回复
热议问题