FindMyWay
A radix-tree HTTP router used by the unstable HTTP routing modules.
Constructors
Models
FindResult interface
Added in v4.0.0
Source
Result of a successful route lookup.
Signature
interface FindResult<A> { readonly handler: A; readonly params: Record<string, string | undefined>; readonly searchParams: Record<string, string | Array<string>>;}Route path accepted by the router.
Signature
type PathInput = `/${string}` | "*"Mutable router used to register and resolve route handlers.
Signature
interface Router<A> { readonly all: (path: PathInput, handler: A) => void; readonly find: (method: string, url: string) => FindResult<A> | undefined; readonly has: (method: string, url: string) => boolean; readonly on: (method: string | Iterable<string, any, any>, path: PathInput, handler: A) => void;}RouterConfig interface
Added in v4.0.0
Source
Configuration for router path matching.
Signature
interface RouterConfig { readonly caseSensitive: boolean; readonly ignoreDuplicateSlashes: boolean; readonly ignoreTrailingSlash: boolean; readonly maxParamLength: number;}