Bird
0
0

How can you securely store session data in a NestJS app to support multiple server instances?

hard📝 Conceptual Q9 of 15
NestJS - Authentication
How can you securely store session data in a NestJS app to support multiple server instances?
AUse a shared store like Redis with express-session
BStore sessions in memory on each server instance
CSave sessions as encrypted cookies only
DUse localStorage on the client to store session data
Step-by-Step Solution
Solution:
  1. Step 1: Understand session storage needs

    In multi-server setups, session data must be shared to keep users logged in across servers.
  2. Step 2: Identify best storage option

    Using Redis as a shared session store with express-session allows all servers to access the same session data.
  3. Final Answer:

    Use a shared store like Redis with express-session -> Option A
  4. Quick Check:

    Shared store like Redis = A [OK]
Quick Trick: Use Redis store for sessions in multi-server apps [OK]
Common Mistakes:
  • Using memory store in production
  • Storing sessions only in cookies
  • Relying on client-side storage for sessions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes