import { INestApplication, RequestMethod, ValidationPipe, VersioningType, } from '@nestjs/common'; import helmet from 'helmet'; import cookieParser from 'cookie-parser'; export function configureApp(app: INestApplication): void { app.use(helmet()); app.use(cookieParser()); app.enableCors({ origin: process.env.FRONTEND_ORIGIN ?? 'http://localhost:3000', credentials: true, }); app.setGlobalPrefix('api', { exclude: [ { path: 'health', method: RequestMethod.GET }, { path: 'health/ready', method: RequestMethod.GET }, ], }); app.enableVersioning({ type: VersioningType.URI, defaultVersion: '1' }); app.useGlobalPipes( new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true, }), ); }