update package-lock.json 050224
This commit is contained in:
+13
@@ -4,8 +4,21 @@ import { NestFactory } from '@nestjs/core';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
function configureCors(app: Awaited<ReturnType<typeof NestFactory.create>>) {
|
||||
const raw = process.env.CORS_ORIGINS?.trim();
|
||||
if (raw) {
|
||||
const origins = raw.split(',').map((o) => o.trim()).filter(Boolean);
|
||||
app.enableCors({ origin: origins, credentials: true });
|
||||
return;
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
app.enableCors({ origin: true, credentials: true });
|
||||
}
|
||||
}
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
configureCors(app);
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
forbidNonWhitelisted: true,
|
||||
|
||||
Reference in New Issue
Block a user