Skip to content
// EFFECT DAYS 2026

FindMyWay unstable

A radix-tree HTTP router used by the unstable HTTP routing modules.

6 exports Since v4.0.0 Source

Constants

Since v4.0.0

Router configuration that turns off path normalization and matches static route text literally.

When to use

Use when a reverse proxy or gateway authorizes requests by path prefix and the router must not resolve a different spelling of that path to a route.

Details

It sets caseSensitive: true, ignoreTrailingSlash: false, ignoreDuplicateSlashes: false, useSemicolonDelimiter: false, and decodeStaticPath: false. A route then matches only when each of its segments without parameters, and the text before the first parameter in each other segment, appears character for character in the request path. Spread it to override individual fields.

Gotchas

Parameter values are still percent-decoded, so a path rule that overlaps a parameter segment, such as /files/secret against /files/:name, can still be reached as /files/%73ecret. Encoded separators such as %2F in parameter values are decoded too, and text after a parameter in the same segment is matched after decoding, so /files/:name.png also matches /files/a%2Epng.

See

Signature

declare const strictConfig: Partial<RouterConfig>

Constructors

make

unstable
Since v4.0.0

Creates an empty mutable router.

Signature

declare const make: <A>(options?: Partial<RouterConfig>) => Router<A>

Models

FindResult

interface unstable
Since v4.0.0

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>>;
}

PathInput

type unstable
Since v4.0.0

Route path accepted by the router.

Signature

type PathInput = `/${string}` | "*"

Router

interface unstable
Since v4.0.0

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 unstable
Since v4.0.0

Configuration for router path matching.

Details

Each field is independent. Omitted fields use the default listed on the field. The defaults normalize request paths before matching; use strictConfig to turn normalization off and match static route text literally.

Gotchas

Normalization options change which request paths reach a route. If a reverse proxy or gateway makes access decisions from the raw path, the router may resolve a request that the proxy saw as a different path. The router sees the path delivered by the platform adapter: Web Request adapters have already resolved dot segments, while Node passes the request target through unchanged.

Signature

interface RouterConfig {
readonly caseSensitive: boolean;
readonly decodeStaticPath?: boolean;
readonly ignoreDuplicateSlashes: boolean;
readonly ignoreTrailingSlash: boolean;
readonly maxParamLength: number;
readonly useSemicolonDelimiter?: boolean;
}