HttpRequest.getPathParamAs

Gets a path parameter as the specified type, or returns the default value if the path parameter with the given name doesn't exist or is of an invalid format.

struct HttpRequest
const
T
getPathParamAs
(
T
)
(
string name
,
T defaultValue = T.init
)

Parameters

name string

The name of the path parameter.

defaultValue T

The default value to return if the path parameter doesn't exist.

Return Value

Type: T

The value of the path parameter.