import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import cookieParser from 'cookie-parser'; import { ConfigService } from '@nestjs/config'; import { ValidationPipe } from '@nestjs/common'; (BigInt.prototype as any).toJSON = function () { return this.toString(); }; async function bootstrap() { const app = await NestFactory.create(AppModule); const configService = app.get(ConfigService); app.setGlobalPrefix('api/'); app.enableCors({ origin: 'http://localhost:5173', credentials: true, methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], allowedHeaders: 'Content-Type, Accept, X-CSRF-Token', }); app.useGlobalPipes( new ValidationPipe({ transform: true, whitelist: true, forbidNonWhitelisted: true, }), ); app.use(cookieParser(configService.get('COOKIE_SECRET'))); await app.listen(configService.get('PORT') ?? 1323); } bootstrap(); // Rate limiting