Chapter quiz · Routing

Test what you learned.

8 questions on Routing. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Routing — Chapter Quiz

Eight questions on @koa/router, ctx.params, ctx.query, router.routes()/allowedMethods(), prefix, per-route middleware, redirect, and 404 fallthrough.

0/ 9
  1. Question 1
    1

    Koa has no built-in router. Which package is the de-facto standard router maintained by the Koa team?

  2. Question 2
    2

    How do you read the :id segment from the URL /users/42 with @koa/router?

  3. Question 3
    3

    Why should you always call both router.routes() and router.allowedMethods() on app.use?

  4. Question 4
    4

    How do you group all routes in a router under the /api/v1 prefix?

  5. Question 5
    5

    Which code correctly issues a 301 permanent redirect to /new-path in @koa/router?

  6. Question 6
    6

    Per-route middleware in @koa/router runs before the route handler and must call await next() to reach it.

  7. Question 7
    7

    Access parsed query-string parameters (e.g. ?page=2) via ctx.___.

  8. Question 8
    8

    Which strategies handle unmatched routes (404) correctly in a Koa app using @koa/router?

    Select all that apply.

Pick an answer — instant feedback as you go.