Skip to content
Snippets Groups Projects
main.ts 584 B
Newer Older
import { NestFactory } from '@nestjs/core';
import { ConfigService } from '@nestjs/config';
import { AppModule } from './app.module';
Martin Korec's avatar
Martin Korec committed
import { ValidationPipe } from '@nestjs/common';
async function bootstrap(): Promise<void> {
  const app = await NestFactory.create(AppModule);
  const configService = app.get(ConfigService);
Martin Korec's avatar
Martin Korec committed
  app.useGlobalPipes(
    new ValidationPipe({
      transform: true,
    }),
  );
  const port = configService.get<number>('PORT') | 4000;
  console.log(`NestJS server is listening on: http://localhost:${port}`);
  await app.listen(port);
bootstrap();