Bird
0
0

Which NestJS feature is best suited to apply a global response transformation?

easy📝 Conceptual Q2 of 15
NestJS - Interceptors
Which NestJS feature is best suited to apply a global response transformation?
AGuard
BMiddleware
CPipe
DGlobal interceptor
Step-by-Step Solution
Solution:
  1. Step 1: Recall the purpose of global interceptors

    Global interceptors can modify all responses across the app.
  2. Step 2: Differentiate from other features

    Middleware runs before controllers, pipes transform inputs, guards handle authorization, so they don't transform responses globally.
  3. Final Answer:

    Global interceptor -> Option D
  4. Quick Check:

    Global response transform = Global interceptor [OK]
Quick Trick: Use global interceptors for app-wide response changes [OK]
Common Mistakes:
  • Confusing middleware with interceptors
  • Using pipes for response transformation
  • Thinking guards modify responses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes