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

  await app.listen(process.env.PORT ?? 3000);
}
void bootstrap();
