Skip to content

Commit cebafdc

Browse files
author
Nicolas MACHEREY
committed
Added documentation's for global pipes transform
1 parent d4481ae commit cebafdc

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,22 @@ export class TestSecuredController {
166166
## Adding the entities to your TypeORM configuration
167167

168168
**IMPORTANT**: The module comes with entities you have to add the configuration `node_modules/@switchit/**/*.entity.js`
169-
to let typeorm scan your entities or add them to the `entitie` configuration variable in TypeORM.
169+
to let typeorm scan your entities or add them to the `entitie` configuration variable in TypeORM.
170+
171+
## Using the global validation pipes
172+
173+
**IMPORTANT**: In addition, you should enable the global validation pipe in your NestJS application. In your `main.ts`
174+
you should add these lines:
175+
176+
```typescript
177+
async function bootstrap() {
178+
const app = await NestFactory.create(AppModule);
179+
useContainer(app.select(AppModule), {fallbackOnErrors: true});
180+
app.useGlobalPipes(new ValidationPipe({
181+
transform: true,
182+
}));
183+
184+
await app.listen(3000);
185+
}
186+
bootstrap();
187+
```

0 commit comments

Comments
 (0)