Skip to main content

Class: RouterRoot

Extends

Constructors

new RouterRoot()

new RouterRoot(): RouterRoot

Returns

RouterRoot

Overrides

RouterBranch.constructor

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:8

Properties

dynamic

readonly dynamic: boolean

Whether or not the branch is dynamic.

Inherited from

RouterBranch.dynamic

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:14


name

readonly name: string

The name of the branch.

Inherited from

RouterBranch.name

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:9


node

readonly node: RouterNode

The node this branch is associated with.

Inherited from

RouterBranch.node

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:24


parent

readonly parent: null | RouterBranch

The parent branch, if any.

Inherited from

RouterBranch.parent

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:19


supportedMethods

supportedMethods: readonly string[] = []

The methods supported by the branch's node or any of its children.

Inherited from

RouterBranch.supportedMethods

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:29

Accessors

children

get children(): RouterBranch[]

The branches the branch is associated with

Version

7.0.0

Returns

RouterBranch[]

Inherited from

RouterBranch.children

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:52


empty

get empty(): boolean

Whether or not the branch is empty

Version

7.0.0

Returns

boolean

Inherited from

RouterBranch.empty

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:60


path

get path(): string

The path representing this branch

Version

7.0.0

Returns

string

Overrides

RouterBranch.path

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:33

Methods

_add()

protected _add(parts: readonly string[], index: number, route: Route<RouteOptions>): RouterNode

Parameters

ParameterType
partsreadonly string[]
indexnumber
routeRoute<RouteOptions>

Returns

RouterNode

Inherited from

RouterBranch._add

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:107


_find()

protected _find(parts: readonly string[], index: number): null | RouterBranch

Parameters

ParameterType
partsreadonly string[]
indexnumber

Returns

null | RouterBranch

Inherited from

RouterBranch._find

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:187


_performAdd()

protected _performAdd(parts: readonly string[], index: number, route: Route<RouteOptions>): RouterNode

Parameters

ParameterType
partsreadonly string[]
indexnumber
routeRoute<RouteOptions>

Returns

RouterNode

Inherited from

RouterBranch._performAdd

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:119


_performRemove()

protected _performRemove(parts: readonly string[], index: number, route: Route<RouteOptions>): boolean

Parameters

ParameterType
partsreadonly string[]
indexnumber
routeRoute<RouteOptions>

Returns

boolean

Inherited from

RouterBranch._performRemove

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:151


_remove()

protected _remove(parts: readonly string[], index: number, route: Route<RouteOptions>): boolean

Parameters

ParameterType
partsreadonly string[]
indexnumber
routeRoute<RouteOptions>

Returns

boolean

Inherited from

RouterBranch._remove

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:113


_updateSupportedChildrenMethods()

protected _updateSupportedChildrenMethods(): void

Returns

void

Inherited from

RouterBranch._updateSupportedChildrenMethods

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:200


add()

add(route: Route<RouteOptions>): RouterNode

Adds a route to the branch

Parameters

ParameterTypeDescription
routeRoute<RouteOptions>The route to add

Returns

RouterNode

The node the route was added to

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:18


find()

find(parts: readonly string[]): null | RouterBranch

Tries to find a branch given a path

Parameters

ParameterTypeDescription
partsreadonly string[]The parts of a path to find a node from

Returns

null | RouterBranch

The branch found, or null if not found

Version

7.0.0

Inherited from

RouterBranch.find

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:71


matches()

matches(name: string): boolean

Checks if the given name matches the branch

Parameters

ParameterTypeDescription
namestringThe name to match

Returns

boolean

Whether or not the branch matches the name

Version

7.0.0

Inherited from

RouterBranch.matches

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:82


nodes()

nodes(): IterableIterator<RouterNode>

Returns

IterableIterator<RouterNode>

Inherited from

RouterBranch.nodes

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterBranch.ts:96


remove()

remove(route: Route<RouteOptions>): boolean

Removes a route from the branch

Parameters

ParameterTypeDescription
routeRoute<RouteOptions>The route to remove

Returns

boolean

Whether or not the route was removed

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:28


toString()

toString(): string

Returns the string representation of the branch

Returns

string

The string representation of the branch

Version

7.0.0

Overrides

RouterBranch.toString

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:37


extractMethod()

static extractMethod(path: readonly string[]): null | "ACL" | "BIND" | "CHECKOUT" | "CONNECT" | "COPY" | "DELETE" | "GET" | "HEAD" | "LINK" | "LOCK" | "M-SEARCH" | "MERGE" | "MKACTIVITY" | "MKCALENDAR" | "MKCOL" | "MOVE" | "NOTIFY" | "OPTIONS" | "PATCH" | "POST" | "PROPFIND" | "PROPPATCH" | "PURGE" | "PUT" | "REBIND" | "REPORT" | "SEARCH" | "SOURCE" | "SUBSCRIBE" | "TRACE" | "UNBIND" | "UNLINK" | "UNLOCK" | "UNSUBSCRIBE"

Parameters

ParameterType
pathreadonly string[]

Returns

null | "ACL" | "BIND" | "CHECKOUT" | "CONNECT" | "COPY" | "DELETE" | "GET" | "HEAD" | "LINK" | "LOCK" | "M-SEARCH" | "MERGE" | "MKACTIVITY" | "MKCALENDAR" | "MKCOL" | "MOVE" | "NOTIFY" | "OPTIONS" | "PATCH" | "POST" | "PROPFIND" | "PROPPATCH" | "PURGE" | "PUT" | "REBIND" | "REPORT" | "SEARCH" | "SOURCE" | "SUBSCRIBE" | "TRACE" | "UNBIND" | "UNLINK" | "UNLOCK" | "UNSUBSCRIBE"

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:82


makeRoutePathForPiece()

static makeRoutePathForPiece(directories: readonly string[], name: string): string

Parameters

ParameterType
directoriesreadonly string[]
namestring

Returns

string

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:41


normalize()

static normalize(path: undefined | null | string): string[]

Parameters

ParameterType
pathundefined | null | string

Returns

string[]

Defined in

projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:58