Routing — Basics · Hono

Give the cats API its routes: a parameter in the path, two parameters, a route that must be registered before the parameterised one, and a DELETE that answers 204.

What you will learn

Read the theory for Routing

All Basics lessons

All Hono courses

loading types…

What you'll learn

  • Read a path parameter with c.req.param('id'), and all of them at once with c.req.param()
  • Register routes for other verbs, and answer 204 with c.body(null, 204)
  • Rely on registration order: Hono tries routes in the order they were added, so a fixed path goes before a parameter that would swallow it