import 'reflect-metadata';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { AuthGuard } from './core/auth.guard';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.setGlobalPrefix('api');
  app.useGlobalGuards(app.get(AuthGuard));
  await app.listen(process.env.PORT ? Number(process.env.PORT) : 3000);
  console.log(`Application is running on: ${await app.getUrl()}`);
}

bootstrap();
