HotRoute
Class: HotRoute
The route to use.
Table of contents​
Constructors​
Properties​
- authCredentials
- connection
- errors
- logger
- methods
- onAuthorizeUser
- onPostRegister
- onPreRegister
- onRegister
- prefix
- route
- version
Methods​
Constructors​
constructor​
• new HotRoute(connection
, route
, methods?
)
Parameters​
Name | Type | Default value |
---|---|---|
connection | HotServer | HotClient | undefined |
route | string | undefined |
methods | HotRouteMethod [] | [] |
Defined in​
Properties​
authCredentials​
• authCredentials: any
The authorization credentials to be used by the client when connecting to the server.
Defined in​
connection​
• connection: HotServer
| HotClient
The server that maintains the connections.
Defined in​
errors​
• errors: Object
The errors and their JSON that can be thrown. Can be:
- not_authorized
Index signature​
â–ª [error: string
]: any
Defined in​
logger​
• logger: HotLog
The associated logger.
Defined in​
methods​
• methods: HotRouteMethod
[]
The calls that can be made.
Defined in​
onAuthorizeUser​
• onAuthorizeUser: (req
: any
, res
: any
) => Promise
<any
> = null
Type declaration​
â–¸ (req
, res
): Promise
<any
>
Executes when authorizing a called method. The value returned from here will be passed to onExecute in the called HotRouteMethod. Undefined returning from here will mean the authorization failed.
Parameters​
Name | Type |
---|---|
req | any |
res | any |
Returns​
Promise
<any
>
Defined in​
onPostRegister​
• onPostRegister: () => Promise
<void
> = null
Type declaration​
â–¸ (): Promise
<void
>
Executes after all routes have been registered.
Returns​
Promise
<void
>
Defined in​
onPreRegister​
• onPreRegister: () => Promise
<void
> = null
Type declaration​
â–¸ (): Promise
<void
>
Executes before all routes have been registered.
Returns​
Promise
<void
>
Defined in​
onRegister​
• onRegister: () => Promise
<boolean
> = null
Type declaration​
â–¸ (): Promise
<boolean
>
Executes when first registering this route with Express. If this returns false, the route will not be registered.
Returns​
Promise
<boolean
>
Defined in​
prefix​
• prefix: string
The prefix to add to the beginning of each route method.
Defined in​
route​
• route: string
The route.
Defined in​
version​
• version: string
The version.
Defined in​
Methods​
addMethod​
â–¸ addMethod(method
, executeFunction?
, type?
, testCases?
): void
Add an API method to this route.
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
method | string | HotRouteMethod | undefined | The name of the method to add. If a HotRouteMethod is supplied, the rest of the arguments supplied will be ignored. |
executeFunction | ServerExecutionFunction | null | - |
type | HTTPMethod | HTTPMethod.POST | - |
testCases | (string | TestCaseFunction )[] | TestCaseFunction [] | TestCaseObject [] | null | - |
Returns​
void
Defined in​
getMethod​
â–¸ getMethod(name
): HotRouteMethod
Get a method by it's name.
Parameters​
Name | Type |
---|---|
name | string |
Returns​
Defined in​
createError​
â–¸ Static
createError(message
): any
Create an error JSON object.
Parameters​
Name | Type |
---|---|
message | string |
Returns​
any