Skip to main content

Class: RouterRoot

Defined in: projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:7

Extends

Constructors

new RouterRoot()

new RouterRoot(): RouterRoot

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

Returns

RouterRoot

Overrides

RouterBranch.constructor

Properties

dynamic

readonly dynamic: boolean

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

Whether or not the branch is dynamic.

Inherited from

RouterBranch.dynamic


name

readonly name: string

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

The name of the branch.

Inherited from

RouterBranch.name


node

readonly node: RouterNode

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

The node this branch is associated with.

Inherited from

RouterBranch.node


parent

readonly parent: null | RouterBranch

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

The parent branch, if any.

Inherited from

RouterBranch.parent


supportedMethods

supportedMethods: readonly string[] = []

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

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

Inherited from

RouterBranch.supportedMethods

Accessors

children

Get Signature

get children(): RouterBranch[]

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

The branches the branch is associated with

Version

7.0.0

Returns

RouterBranch[]

Inherited from

RouterBranch.children


empty

Get Signature

get empty(): boolean

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

Whether or not the branch is empty

Version

7.0.0

Returns

boolean

Inherited from

RouterBranch.empty


path

Get Signature

get path(): string

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

The path representing this branch

Version

7.0.0

Returns

string

Overrides

RouterBranch.path

Methods

_add()

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

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

Parameters

ParameterType
partsreadonly string[]
indexnumber
routeRoute

Returns

RouterNode

Inherited from

RouterBranch._add


_find()

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

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

Parameters

ParameterType
partsreadonly string[]
indexnumber

Returns

null | RouterBranch

Inherited from

RouterBranch._find


_performAdd()

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

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

Parameters

ParameterType
partsreadonly string[]
indexnumber
routeRoute

Returns

RouterNode

Inherited from

RouterBranch._performAdd


_performRemove()

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

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

Parameters

ParameterType
partsreadonly string[]
indexnumber
routeRoute

Returns

boolean

Inherited from

RouterBranch._performRemove


_remove()

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

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

Parameters

ParameterType
partsreadonly string[]
indexnumber
routeRoute

Returns

boolean

Inherited from

RouterBranch._remove


_updateSupportedChildrenMethods()

protected _updateSupportedChildrenMethods(): void

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

Returns

void

Inherited from

RouterBranch._updateSupportedChildrenMethods


add()

add(route: Route): RouterNode

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

Adds a route to the branch

Parameters

ParameterTypeDescription
routeRouteThe route to add

Returns

RouterNode

The node the route was added to


find()

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

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

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


matches()

matches(name: string): boolean

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

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


nodes()

nodes(): IterableIterator<RouterNode>

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

Returns

IterableIterator<RouterNode>

Inherited from

RouterBranch.nodes


remove()

remove(route: Route): boolean

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

Removes a route from the branch

Parameters

ParameterTypeDescription
routeRouteThe route to remove

Returns

boolean

Whether or not the route was removed


toString()

toString(): string

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

Returns the string representation of the branch

Returns

string

The string representation of the branch

Version

7.0.0

Overrides

RouterBranch.toString


extractMethod()

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

Defined in: projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:84

Parameters

ParameterType
pathstring | readonly string[]

Returns

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


makeRoutePathForPiece()

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

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

Parameters

ParameterType
directoriesreadonly string[]
namestring

Returns

string


normalize()

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

Defined in: projects/plugins/packages/api/src/lib/structures/router/RouterRoot.ts:61

Parameters

ParameterType
pathundefined | null | string

Returns

string[]