Skip to content

FindMyWay

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

5 exports Added in v4.0.0 Source

Constructors

make

Added in v4.0.0 Source

Signature

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

Models

FindResult interface

Added in v4.0.0 Source

Signature

interface FindResult<A> {
readonly handler: A;
readonly params: Record<string, string | undefined>;
readonly searchParams: Record<string, string | Array<string>>;
}

PathInput type

Added in v4.0.0 Source

Signature

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

Router interface

Added in v4.0.0 Source

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

Signature

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