import { NestFactory } from '@nestjs/core'; import { FastifyAdapter, NestFastifyApplication, } from '@nestjs/platform-fastify'; import { ValidationPipe } from '@nestjs/common'; import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create( AppModule, new FastifyAdapter(), ); // Global validation pipe app.useGlobalPipes( new ValidationPipe({ transform: true, whitelist: true, forbidNonWhitelisted: true, }), ); // Enable CORS app.enableCors({ origin: true, credentials: true, }); // Global prefix app.setGlobalPrefix('api'); const port = process.env.PORT || 3000; await app.listen(port, '0.0.0.0'); console.log(`🚀 Application is running on: http://localhost:${port}/api`); } bootstrap();