QuizzesRoute Handlers — Concept Check
intermediate
nextjs

Route Handlers — Concept Check

Questions on Route Handlers. route.ts gives you a real HTTP endpoint. Server actions replaced most of the reasons to write one, but webhooks, public APIs and file responses still need it.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Route Handlers — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.You are developing a webhook endpoint for a payment provider. Which practice is essential to ensure security?

    • AStore the raw body in a database
    • BParse the body before verifying the signature
    • CUse GET method for webhook endpoints
    • DVerify the signature before parsing the body
  2. 2.A developer wants to create a route handler that returns a CSV file. Which HTTP method should be used?

    • APOST
    • BGET
    • CDELETE
    • DPUT
  3. 3.A route handler is returning a 405 error. What is the most likely cause?

    • AThe HTTP method is not exported in route.ts
    • BThe route.ts file is missing
    • CThe request body is too large
    • DThe request is missing headers
  4. 4.Which scenario necessitates the use of a route handler instead of a server action?

    • ARendering a React component
    • BFetching data for a server component
    • CPerforming a database query
    • DHandling a webhook from a payment provider
  5. 5.A developer is using Next.js 15 and notices unexpected caching behavior in a GET handler. What might be the issue?

    • AThe handler is not authenticated
    • BThe revalidate export is missing
    • CThe handler is incorrectly using POST
    • DThe dynamic export is missing
  6. 6.Why might a route handler need to explicitly handle CORS?

    • ATo allow requests from different origins
    • BTo improve server performance
    • CTo enable server-side rendering
    • DTo simplify code structure
  7. 7.A public API endpoint is being developed. What is a critical security measure to implement?

    • AAllowing all origins in CORS
    • BRate limiting for unauthenticated requests
    • CCaching all responses
    • DUsing GET for all requests
  8. 8.What is a consequence of not exporting OPTIONS in a route handler?

    • AThe handler will not support POST requests
    • BThe handler will only support JSON responses
    • CPreflight requests from other origins may fail
    • DThe handler will automatically cache responses