Chapter quiz · Data & Auth

Test what you learned.

8 questions on Data & Auth. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Data & Auth — Chapter Quiz

Eight questions on the db plugin pattern, Postgres, Prisma, Drizzle, MongoDB, cookies, JWT, sessions, and CSRF.

0/ 9
  1. Question 1
    1

    What's the idiomatic way to share a database client across routes?

  2. Question 2
    2

    What does @fastify/postgres provide?

  3. Question 3
    3

    Prisma and Drizzle each have a Fastify plugin pattern, but they're both used by decorating the app with the client.

  4. Question 4
    4

    To read a cookie from a request after registering @fastify/cookie, you use request.____.sid.

  5. Question 5
    5

    What does @fastify/jwt give you?

  6. Question 6
    6

    Which is generally safer for browser-facing session auth?

  7. Question 7
    7

    After this hook, what does request.user contain on a valid JWT request?

    app.addHook('onRequest', async (request) => {
      await request.jwtVerify();
    });
    
  8. Question 8
    8

    Which mitigations help against CSRF on cookie-based auth?

    Select all that apply.

Pick an answer — instant feedback as you go.