NestJS - AuthenticationWhich NestJS middleware is commonly used to enable session support for session-based authentication?Apassport.session()Bexpress-sessionCcookie-parserDbody-parserCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify middleware for session managementexpress-session is the middleware that manages sessions and stores session data server-side.Step 2: Differentiate from other middlewarescookie-parser parses cookies but does not manage sessions; passport.session() integrates with passport but depends on express-session.Final Answer:express-session -> Option BQuick Check:express-session manages sessions = A [OK]Quick Trick: Use express-session middleware to handle sessions [OK]Common Mistakes:Confusing cookie-parser with session managementUsing body-parser for sessionsAssuming passport.session() alone manages sessions
Master "Authentication" in NestJS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More NestJS Quizzes Authentication - Why authentication secures NestJS APIs - Quiz 15hard Authentication - Refresh token pattern - Quiz 6medium Database with Prisma - Schema definition - Quiz 11easy Database with Prisma - Schema definition - Quiz 10hard Database with Prisma - Prisma Client usage - Quiz 14medium Database with TypeORM - Repository pattern - Quiz 1easy Middleware - Why middleware processes requests before handlers - Quiz 2easy Pipes - Default value pipe - Quiz 12easy Pipes - Built-in pipes (ParseIntPipe, ParseBoolPipe) - Quiz 8hard Pipes - File validation pipe - Quiz 7medium