Node.js Framework Series — 1.2.7. NestJS — Pipes
2 min readFeb 7, 2021
We create a pipe as a class with the @Injectable() decorator which should implement the PipeTransform interface. In general we use the pipes for the following cases:
- Transformation: to transform input data to the desired form(i.e., string to JSON object, integer to string..)
- Validation: to check the input data (e.g., JSON schema validation — if data is not valid, throw an exception..)