Files
thebet365/apps/api/src/main.ts
Mars b2216abd0c feat(admin,api,player): 返水流程优化、账单详情与数据库重置
优化返水预览/确认/作废,新增玩家账变详情与后台一键重置为 seed 数据,并修复 dev 启动时 3000 端口占用。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 11:14:22 +08:00

40 lines
1.2 KiB
TypeScript

import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { NestExpressApplication } from '@nestjs/platform-express';
import { join } from 'path';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule);
app.enableShutdownHooks();
const uploadDir = process.env.UPLOAD_DIR || join(__dirname, '..', '..', 'uploads');
app.useStaticAssets(uploadDir, { prefix: '/uploads/' });
app.setGlobalPrefix('api');
app.enableCors({ origin: true, credentials: true });
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
transform: true,
forbidNonWhitelisted: true,
}),
);
const config = new DocumentBuilder()
.setTitle('TheBet365 API')
.setDescription('足球投注平台 MVP API')
.setVersion('1.0')
.addBearerAuth()
.build();
SwaggerModule.setup('api/docs', app, SwaggerModule.createDocument(app, config));
const port = process.env.PORT || 3000;
await app.listen(port);
console.log(`API running on http://localhost:${port}`);
console.log(`Swagger docs: http://localhost:${port}/api/docs`);
}
bootstrap();