NestJS · Middleware · Junior · Comparison
Middleware vs Guard vs Interceptor — which for auth?
Short Interview Answer
Guards are the Nest-idiomatic authn/authz gate; middleware for low-level request shaping; interceptors for AOP around handlers.
Detailed Explanation
You can authenticate in middleware, but guards integrate better with roles/metadata. Know the official pipeline order.
Interview Tip
Recite middleware → guards → interceptors(before) → pipes → handler → interceptors(after) → filters.