NestJS - InterceptorsWhich NestJS feature is best suited to apply a global response transformation?AGuardBMiddlewareCPipeDGlobal interceptorCheck Answer
Step-by-Step SolutionSolution:Step 1: Recall the purpose of global interceptorsGlobal interceptors can modify all responses across the app.Step 2: Differentiate from other featuresMiddleware runs before controllers, pipes transform inputs, guards handle authorization, so they don't transform responses globally.Final Answer:Global interceptor -> Option DQuick Check:Global response transform = Global interceptor [OK]Quick Trick: Use global interceptors for app-wide response changes [OK]Common Mistakes:Confusing middleware with interceptorsUsing pipes for response transformationThinking guards modify responses
Master "Interceptors" in NestJS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More NestJS Quizzes Database with Prisma - Prisma migrations - Quiz 12easy Database with TypeORM - Repository pattern - Quiz 12easy Guards - Why guards control access - Quiz 13medium Guards - Guard binding levels - Quiz 12easy Interceptors - Logging interceptor - Quiz 11easy Interceptors - Why interceptors add cross-cutting logic - Quiz 8hard Middleware - Why middleware processes requests before handlers - Quiz 9hard Middleware - Why middleware processes requests before handlers - Quiz 4medium Pipes - Custom pipes - Quiz 12easy Pipes - Built-in pipes (ParseIntPipe, ParseBoolPipe) - Quiz 13medium