← index

[Web]Router

inherits Object · defined at web/02-route.qn:180

Per-verb route tables with most-specific-wins dispatch. The router is pure data + matching — the [Web]App (and anyone else) drives it.

Instance methods

add: pattern: handler:

Register handler for verb (e.g. 'GET') and pattern. A duplicate shape under the same verb throws ValueError at registration.

web/02-route.qn:186

allowFor:

The verbs whose tables match path (for a 405's Allow header).

web/02-route.qn:230

dispatch: path:

Dispatch verb + path (query already stripped). Returns a tagged list: #( #ok handler paramsMap ) — the most specific match #( #methodNotAllowed allowList ) — other verbs match this path (-> 405) #( #notFound ) — nothing matches anywhere (-> 404) HEAD falls back to the GET table (the transport suppresses the body).

web/02-route.qn:208

init

Internal: an empty verb -> route-table map.

web/02-route.qn:182