import { NestFactory } from '@nestjs/core';
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();
