import { NestFactory } from '@nestjs/core'; import { ValidationPipe } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule); // Global validation pipe app.useGlobalPipes( new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true, }), ); // Enable CORS app.enableCors({ origin: process.env.CORS_ORIGINS?.split(',') || ['http://localhost:5173'], credentials: true, }); // API prefix app.setGlobalPrefix('api/v1', { exclude: ['health'] }); const configService = app.get(ConfigService); const port = configService.get('PORT') || 3006; await app.listen(port); console.log(`File Service is running on port ${port}`); } bootstrap();