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); app.useGlobalPipes( new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true, }), ); app.enableCors({ origin: process.env.CORS_ORIGINS?.split(',') || ['http://localhost:5173'], credentials: true, }); app.setGlobalPrefix('api/v1', { exclude: ['health'] }); const configService = app.get(ConfigService); const port = configService.get('USER_SERVICE_PORT') || 3001; await app.listen(port); console.log(`User Service is running on port ${port}`); } bootstrap();