Skip to content

Cerces


Cerces / routing / RouteMatcher

Class: RouteMatcher ​

Defined in: src/routing.ts:275

Manages a collection of routes and provides functionality to match incoming HTTP requests to routes.

This class builds a tree structure for efficient route matching and supports middleware inheritance.

Constructors ​

Constructor ​

new RouteMatcher(): RouteMatcher

Defined in: src/routing.ts:279

Returns ​

RouteMatcher

Properties ​

routes ​

routes: Route<any, any, any>[]

Defined in: src/routing.ts:276


tree ​

tree: RouteNode

Defined in: src/routing.ts:277

Accessors ​

length ​

Get Signature ​

get length(): number

Defined in: src/routing.ts:290

Returns ​

number

Methods ​

[iterator]() ​

[iterator](): IterableIterator<Route<any, any, any>>

Defined in: src/routing.ts:284

Returns ​

IterableIterator<Route<any, any, any>>


get() ​

get(path): RouteNode

Defined in: src/routing.ts:294

Parameters ​

path ​

string

Returns ​

RouteNode


set() ​

set(path, values): RouteNode

Defined in: src/routing.ts:312

Parameters ​

path ​

null | string

values ​
middleware? ​

Middleware[]

Returns ​

RouteNode


push() ​

push(...routes): number

Defined in: src/routing.ts:320

Parameters ​

routes ​

...Route<any, any, any>[]

Returns ​

number


match() ​

match(method, path): [undefined | null | Route<any, any, any>, Record<string, string>, Middleware[]]

Defined in: src/routing.ts:329

Parameters ​

method ​

string

path ​

string

Returns ​

[undefined | null | Route<any, any, any>, Record<string, string>, Middleware[]]