Class: RouterRoot
Defined in: packages/api/src/lib/structures/router/RouterRoot.ts:7
Extends
Constructors
Constructor
new RouterRoot():
RouterRoot
Defined in: packages/api/src/lib/structures/router/RouterRoot.ts:8
Returns
RouterRoot
Overrides
Properties
dynamic
readonlydynamic:boolean
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:14
Whether or not the branch is dynamic.
Inherited from
name
readonlyname:string
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:9
The name of the branch.
Inherited from
node
readonlynode:RouterNode
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:24
The node this branch is associated with.
Inherited from
parent
readonlyparent:null|RouterBranch
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:19
The parent branch, if any.
Inherited from
supportedMethods
supportedMethods: readonly
string[] =[]
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:29
The methods supported by the branch's node or any of its children.
Inherited from
Accessors
children
Get Signature
get children():
RouterBranch[]
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:52
The branches the branch is associated with
Version
7.0.0
Returns
Inherited from
empty
Get Signature
get empty():
boolean
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:60
Whether or not the branch is empty
Version
7.0.0
Returns
boolean
Inherited from
path
Get Signature
get path():
string
Defined in: packages/api/src/lib/structures/router/RouterRoot.ts:33
The path representing this branch
Version
7.0.0
Returns
string
Overrides
Methods
_add()
protected_add(parts: readonlystring[],index:number,route:Route):RouterNode
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:107
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
| route | Route | 
Returns
Inherited from
_find()
protected_find(parts: readonlystring[],index:number):null|RouterBranch
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:187
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
Returns
null | RouterBranch
Inherited from
_performAdd()
protected_performAdd(parts: readonlystring[],index:number,route:Route):RouterNode
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:119
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
| route | Route | 
Returns
Inherited from
_performRemove()
protected_performRemove(parts: readonlystring[],index:number,route:Route):boolean
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:151
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
| route | Route | 
Returns
boolean
Inherited from
_remove()
protected_remove(parts: readonlystring[],index:number,route:Route):boolean
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:113
Parameters
| Parameter | Type | 
|---|---|
| parts | readonly string[] | 
| index | number | 
| route | Route | 
Returns
boolean
Inherited from
_updateSupportedChildrenMethods()
protected_updateSupportedChildrenMethods():void
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:200
Returns
void
Inherited from
RouterBranch._updateSupportedChildrenMethods
add()
add(
route:Route):RouterNode
Defined in: packages/api/src/lib/structures/router/RouterRoot.ts:18
Adds a route to the branch
Parameters
| Parameter | Type | Description | 
|---|---|---|
| route | Route | The route to add | 
Returns
The node the route was added to
find()
find(
parts: readonlystring[]):null|RouterBranch
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:71
Tries to find a branch given a path
Parameters
| Parameter | Type | Description | 
|---|---|---|
| parts | readonly 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
matches()
matches(
name:string):boolean
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:82
Checks if the given name matches the branch
Parameters
| Parameter | Type | Description | 
|---|---|---|
| name | string | The name to match | 
Returns
boolean
Whether or not the branch matches the name
Version
7.0.0
Inherited from
nodes()
nodes():
IterableIterator<RouterNode>
Defined in: packages/api/src/lib/structures/router/RouterBranch.ts:96
Returns
IterableIterator<RouterNode>
Inherited from
remove()
remove(
route:Route):boolean
Defined in: packages/api/src/lib/structures/router/RouterRoot.ts:28
Removes a route from the branch
Parameters
| Parameter | Type | Description | 
|---|---|---|
| route | Route | The route to remove | 
Returns
boolean
Whether or not the route was removed
toString()
toString():
string
Defined in: 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
extractMethod()
staticextractMethod(path:string| readonlystring[]):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: packages/api/src/lib/structures/router/RouterRoot.ts:84
Parameters
| Parameter | Type | 
|---|---|
| path | string| readonlystring[] | 
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()
staticmakeRoutePathForPiece(directories: readonlystring[],name:string):string
Defined in: packages/api/src/lib/structures/router/RouterRoot.ts:41
Parameters
| Parameter | Type | 
|---|---|
| directories | readonly string[] | 
| name | string | 
Returns
string
normalize()
staticnormalize(path:undefined|null|string):string[]
Defined in: packages/api/src/lib/structures/router/RouterRoot.ts:61
Parameters
| Parameter | Type | 
|---|---|
| path | undefined|null|string | 
Returns
string[]