Skip to content
Snippets Groups Projects
Commit f76b698e authored by Martin Korec's avatar Martin Korec
Browse files

fix: add ValidationPipe

parent 13fb0967
No related branches found
No related tags found
No related merge requests found
import { NestFactory } from '@nestjs/core'; import { NestFactory } from '@nestjs/core';
import { ConfigService } from '@nestjs/config'; import { ConfigService } from '@nestjs/config';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
import { ValidationPipe } from '@nestjs/common';
async function bootstrap(): Promise<void> { async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
const configService = app.get(ConfigService); const configService = app.get(ConfigService);
app.useGlobalPipes(
new ValidationPipe({
transform: true,
}),
);
const port = configService.get<number>('PORT') | 4000; const port = configService.get<number>('PORT') | 4000;
console.log(`NestJS server is listening on: http://localhost:${port}`); console.log(`NestJS server is listening on: http://localhost:${port}`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment