Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Route

A Route describes an application path (possibly parameterized), incl. parameter coercion, validation and overall route authentication. Apart from id and match all other fields are optional.

Hierarchy

  • IID<string>
    • Route

Indexable

[id: string]: any

Allow route objects to be extented w/ custom data

Index

Properties

Optional auth

auth: undefined | false | true

Flag to indicate if this route should be passed to the globally configured authentication function. Only matched and validated routes are processed.

Readonly id

id: string

match

match: string[]

Array of path components. If a value is prefixed with ? this path component will be captured under that name. E.g. ["projects", "?id"] will match any of these routes:

  • projects/123
  • projects/abcde

validate options can then be used to further restrict the possible value range of the id value...

Optional title

title: undefined | string

Optional route title (passed to RouteMatch)

Optional validate

validate: IObjectOf<RouteParamValidator>

This object specifies coercions and validators for variable / parameterized path components, e.g.

{
 id: {
         coerce: (x) => parseInt(x,10),
         validate: (x)=> x < 100
     }
}

This will first coerce the id route param to a number and then only allow the route to be matched if id < 100.

Generated using TypeDoc