Question · Vibe coding with Claude Code course · Module 14: Pinterest clone

Quiz: The id in a dynamic route

Where does the handler in app/api/pins/[id]/route.ts get the pin id from?

Answer options

  • From request.json(), because the id arrives in the request body
  • From parseInt on the request address, because the id is a number
  • From the ?id= parameter in the address, through searchParams
  • From the params object, which must first be read with await (const { id } = await params)

You can check the correct answer by solving this task in the CodeWorlds game.