diff --git a/package-lock.json b/package-lock.json index 86e34ab..e8a870b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3049,6 +3049,11 @@ "safe-buffer": "^5.0.1" } }, + "class-transformer": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.3.1.tgz", + "integrity": "sha512-cKFwohpJbuMovS8xVLmn8N2AUbAuc8pVo4zEfsUVo8qgECOogns1WVk/FkOZoxhOPTyTYFckuoH+13FO+MQ8GA==" + }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", diff --git a/package.json b/package.json index f29a515..4b2a70a 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@nestjs/platform-fastify": "^6.10.13", "@nestjs/typeorm": "^6.2.0", "apollo-server-fastify": "^2.9.15", + "class-transformer": "^0.3.1", "class-validator": "^0.11.0", "graphql": "^14.5.8", "graphql-tools": "^4.0.6", diff --git a/src/main.ts b/src/main.ts index 5e446ce..52c621d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ import { NestFactory } from '@nestjs/core'; +import { ValidationPipe } from '@nestjs/common'; import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify'; import * as helmet from 'helmet'; import { AppModule } from './app.module'; @@ -6,7 +7,9 @@ import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule, new FastifyAdapter({ logger: true })); app.use(helmet()); + app.useGlobalPipes(new ValidationPipe()); app.enableCors(); + await app.listen(process.env.PORT || 3000, '0.0.0.0'); } bootstrap();