Class: Router
Hierarchy
EventEmitter
↳
Router
Constructors
constructor
• new Router(app
)
Parameters
Name | Type |
---|---|
app | App |
Overrides
EventEmitter.constructor
Defined in
packages/disploy/src/router/Router.ts:33
Properties
app
• Private
app: App
Defined in
packages/disploy/src/router/Router.ts:30
ready
• Private
ready: boolean
= false
Defined in
packages/disploy/src/router/Router.ts:31
routes
• Private
routes: BaseRoute
[] = []
Defined in
packages/disploy/src/router/Router.ts:28
verifier
• Private
Optional
verifier: null
| Verify
= null
Defined in
packages/disploy/src/router/Router.ts:29
prefixed
▪ Static
prefixed: string
| boolean
Inherited from
EventEmitter.prefixed
Defined in
node_modules/eventemitter3/index.d.ts:9
Methods
addListener
▸ addListener<T
>(event
, fn
, context?
): Router
Type parameters
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : any []) => void |
context? | any |
Returns
Inherited from
EventEmitter.addListener
Defined in
node_modules/eventemitter3/index.d.ts:45
addRoute
▸ addRoute(route
): void
Parameters
Name | Type |
---|---|
route | BaseRoute |
Returns
void
Defined in
packages/disploy/src/router/Router.ts:51
emit
▸ emit<T
>(event
, ...args
): boolean
Calls each of the listeners registered for a given event.
Type parameters
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
...args | any [] |
Returns
boolean
Inherited from
EventEmitter.emit
Defined in
node_modules/eventemitter3/index.d.ts:32
entry
▸ entry(req
): Promise
<TResponse
>
Parameters
Name | Type |
---|---|
req | TRequest |
Returns
Promise
<TResponse
>
Defined in
packages/disploy/src/router/Router.ts:71
eventNames
▸ eventNames(): (string
| symbol
)[]
Return an array listing the events for which the emitter has registered listeners.
Returns
(string
| symbol
)[]
Inherited from
EventEmitter.eventNames
Defined in
node_modules/eventemitter3/index.d.ts:15
handle
▸ Private
handle(req
, res
): Promise
<TResponse
>
Parameters
Name | Type |
---|---|
req | TRequest |
res | TResponse |
Returns
Promise
<TResponse
>
Defined in
packages/disploy/src/router/Router.ts:125
listenerCount
▸ listenerCount(event
): number
Return the number of listeners listening to a given event.
Parameters
Name | Type |
---|---|
event | string | symbol |
Returns
number
Inherited from
EventEmitter.listenerCount
Defined in
node_modules/eventemitter3/index.d.ts:27
listeners
▸ listeners<T
>(event
): (...args
: any
[]) => void
[]
Return the listeners registered for a given event.
Type parameters
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
Returns
(...args
: any
[]) => void
[]
Inherited from
EventEmitter.listeners
Defined in
node_modules/eventemitter3/index.d.ts:20
off
▸ off<T
>(event
, fn?
, context?
, once?
): Router
Type parameters
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn? | (...args : any []) => void |
context? | any |
once? | boolean |
Returns
Inherited from
EventEmitter.off
Defined in
node_modules/eventemitter3/index.d.ts:69
on
▸ on<T
>(event
, fn
, context?
): Router
Add a listener for a given event.
Type parameters
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : any []) => void |
context? | any |
Returns
Inherited from
EventEmitter.on
Defined in
node_modules/eventemitter3/index.d.ts:40
once
▸ once<T
>(event
, fn
, context?
): Router
Add a one-time listener for a given event.
Type parameters
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : any []) => void |
context? | any |
Returns
Inherited from
EventEmitter.once
Defined in
node_modules/eventemitter3/index.d.ts:54
removeAllListeners
▸ removeAllListeners(event?
): Router
Remove all listeners, or those of the specified event.
Parameters
Name | Type |
---|---|
event? | string | symbol |
Returns
Inherited from
EventEmitter.removeAllListeners
Defined in
node_modules/eventemitter3/index.d.ts:79
removeListener
▸ removeListener<T
>(event
, fn?
, context?
, once?
): Router
Remove the listeners of a given event.
Type parameters
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn? | (...args : any []) => void |
context? | any |
once? | boolean |
Returns
Inherited from
EventEmitter.removeListener
Defined in
node_modules/eventemitter3/index.d.ts:63
routeResolver
▸ Private
routeResolver(payload
): undefined
| BaseRoute
Parameters
Name | Type |
---|---|
payload | APIInteraction |
Returns
undefined
| BaseRoute
Defined in
packages/disploy/src/router/Router.ts:101
start
▸ start(): void
Returns
void
Defined in
packages/disploy/src/router/Router.ts:38
verifyRequest
▸ Private
verifyRequest(req
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
req | TRequest |
Returns
Promise
<boolean
>
Defined in
packages/disploy/src/router/Router.ts:55