Bird
0
0

Why does this global pipe binding fail?

medium📝 Debug Q7 of 15
NestJS - Pipes
Why does this global pipe binding fail?
app.useGlobalPipes(ValidationPipe)
AGlobal pipes must be bound inside controllers
BValidationPipe is not instantiated with 'new'
CuseGlobalPipes is not a valid method
DValidationPipe cannot be used globally
Step-by-Step Solution
Solution:
  1. Step 1: Check global pipe binding syntax

    Global pipes require instances, so 'new ValidationPipe()' is needed.
  2. Step 2: Identify missing instantiation

    Passing ValidationPipe class without 'new' causes failure.
  3. Final Answer:

    ValidationPipe is not instantiated with 'new' -> Option B
  4. Quick Check:

    Global pipes need instantiated pipe objects [OK]
Quick Trick: Global pipes require 'new' to instantiate pipe [OK]
Common Mistakes:
  • Passing pipe class instead of instance globally
  • Thinking useGlobalPipes is invalid
  • Assuming global pipes must be inside controllers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes