Performance: Built-in pipes (ParseIntPipe, ParseBoolPipe)
MEDIUM IMPACT
These pipes affect request processing speed and input validation before controller logic runs.
async getUser(@Query('id', ParseIntPipe) id: number) { return this.userService.findById(id); }
async getUser(@Query('id') id: string) { const userId = parseInt(id); if (isNaN(userId)) throw new BadRequestException('Invalid id'); return this.userService.findById(userId); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual parsing in controller | N/A (server-side) | N/A | N/A | [X] Bad |
| Using ParseIntPipe and ParseBoolPipe | N/A (server-side) | N/A | N/A | [OK] Good |