NestJS Extensions
[WIP] A bunch of useful and opinionated filters, modules, pipes... to use with Nest framework. 😻
Setup
npm install nestjs-extensions@latest
Usage
-
ApplicationExceptionFilter
is a nestjs filter use to catch all exceptions & errors in the application.;// ... other imports;app.useGlobalFiltersnew ApplicationExceptionFilter; -
DtoPipe
&Dto
is used for validation. Internally it usesclass-transformer
&class-validator
.- Step 1 - use the pipe, it requires a nestjs
Reflector
.
;// ... other imports;app.useGlobalPipesnew DtoPipenew Reflector;- Step 2 - create a file called
create-post.dto.ts
;;;- Step 3 - use it inside your controller
// ... - Step 1 - use the pipe, it requires a nestjs