Composing apps — Basics · Hono

Split the API into files, one Hono app per resource, mount them with app.route() and put the whole thing under a base path.

What you will learn

Read the theory for Composing apps

All Basics lessons

All Hono courses

loading types…

What you'll learn

  • Write a resource as its own Hono app in its own file, with paths relative to where it will be mounted
  • Mount sub-apps with app.route(prefix, subApp) and prefix everything with basePath()
  • Know the ordering rule: a sub-app's routes are copied when app.route() runs, so register them first