Files
lehuo/apps/api/src/main.ts
T
climber 4412a416ed fix: 更新域名从 lhgy.net 到 www.lhgy.net
- 更新 .env.local 中的域名配置
- 更新 infra/deploy/.env.local
- 更新 compose.local.yaml 中的环境变量
- 更新 admin-web 构建参数 VITE_API_BASE_URL
- 更新小程序 app.ts 中的 apiBaseUrl
2026-10-24 19:49:59 +08:00

40 lines
1.2 KiB
TypeScript

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<void> {
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();