在NestJS中允许接口跨域

2024-09-23
//main.ts
app.enableCors({
    origin: '*',
    methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
    preflightContinue: true,
    optionsSuccessStatus: 204,
    credentials: true,
    allowedHeaders: [
      'Origin',
      'X-Requested-With',
      'Content-Type',
      'Accept',
      'Content-Type',
      'Authorization',
    ],
  });

PREV
生产环境中的nest-winston关闭控制台颜色
NEXT
集成nest-winston日志模块