forked from wangziqi/gongxue-base
- docker-compose.yml: 移除 MySQL 容器,连宿主机 MySQL - main.ts: 启动前通过独立 DataSource 执行 runMigrations - migration-runner.ts: 独立 migration 执行器 - app.module.ts: TypeORM 配置增加 migrations - 修复 InitialSchema 中 room_expenses 和 financial_operations 重复索引
16 lines
504 B
TypeScript
16 lines
504 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import { AppModule } from './app.module';
|
|
import { runMigrationsOnStartup } from './migration-runner';
|
|
|
|
async function bootstrap() {
|
|
await runMigrationsOnStartup();
|
|
|
|
const app = await NestFactory.create(AppModule);
|
|
app.setGlobalPrefix('api');
|
|
app.enableCors();
|
|
await app.listen(process.env.PORT ?? 3000);
|
|
console.log(`Server running on http://localhost:${process.env.PORT ?? 3000}`);
|
|
}
|
|
bootstrap();
|