Routing

File is route. Route is file.

The short version

  • Every .phtml, .html, .js, and .md file in your pages directory becomes a route
  • Files starting with _ are private and never become routes
  • Wrap a segment in [brackets] for dynamic params — accessible via req.params
  • An index file maps to the directory root
  • A .js handler wins over a .html document at the same URL pattern
  • Static files in public/ are served directly, bypassing the router

Route discovery order

At startup, index97 scans with Bun.Glob and deduplicates by pattern. Handlers (.js) take precedence over documents (.html) at the same pattern. Among routes of the same kind, the first discovered wins.

See Architecture for the full request lifecycle.