feat: useGlobalValidationPipe with whitelist

This commit is contained in:
Mathis H (Avnyr) 2024-02-27 16:46:11 +01:00
parent 577d96d68c
commit d4a9519cbf
Signed by: Mathis
GPG Key ID: 9B3849C18C153DDD

View File

@ -1,8 +1,14 @@
import { NestFactory } from '@nestjs/core'; import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
import { ValidationPipe } from "@nestjs/common";
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
}),
);
await app.listen(3333); await app.listen(3333);
} }
bootstrap(); bootstrap();