import 'reflect-metadata'; // BigInt JSON serialization support for Prisma 7.x - MUST be before any Prisma imports ;(BigInt.prototype as any).toJSON = function () { return this.toString(); }; import { ValidationPipe } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import cookieParser from 'cookie-parser'; import { AppModule } from './app.module'; import { AppConfigService } from './config/app-config.service'; async function bootstrap(): Promise { const app = await NestFactory.create(AppModule); const config = app.get(AppConfigService); app.use(cookieParser()); app.enableCors({ origin: config.adminWebOrigin, credentials: true }); app.useGlobalPipes( new ValidationPipe({ transform: true, whitelist: true, forbidNonWhitelisted: true, }), ); const openApi = new DocumentBuilder() .setTitle('乐活公益暖心服务平台 API') .setVersion('1.0') .addBearerAuth() .addCookieAuth('lehuo_admin_session') .build(); SwaggerModule.setup('api/docs', app, SwaggerModule.createDocument(app, openApi)); app.enableShutdownHooks(); await app.listen(config.apiPort, '0.0.0.0'); } void bootstrap();