Class: RouteParams
Constructors
constructor
• new RouteParams(app
, template
, data
)
Parameters
Name | Type |
---|---|
app | null | App |
template | string |
data | string |
Defined in
packages/disploy/src/router/RouteParams.ts:7
Properties
app
• Private
app: null
| App
Defined in
packages/disploy/src/router/RouteParams.ts:7
params
• Private
params: Record
<string
, string
> = {}
Defined in
packages/disploy/src/router/RouteParams.ts:5
Methods
getParam
▸ getParam(name
): string
Get a parameter from the route.
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the parameter |
Returns
string
A string representation of the parameter
Defined in
packages/disploy/src/router/RouteParams.ts:26
getUserParam
▸ getUserParam(name
): Promise
<User
>
Get a user from the route parameters.
Throws
If the User cannot be found or the parameter is not a valid user ID
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the parameter |
Returns
Promise
<User
>
A User structure if the parameter is a valid user ID
Defined in
packages/disploy/src/router/RouteParams.ts:42
matchTemplate
▸ Static
matchTemplate(template
, data
): boolean
Match a template against a data string.
Example
'ping-:id' vs 'ping-123' => true
'ping-:id' vs 'ping-123-456' => false
Parameters
Name | Type | Description |
---|---|---|
template | string | The template to match against |
data | string | The data to match |
Returns
boolean
Whether the data matches the template
Defined in
packages/disploy/src/router/RouteParams.ts:60