Class: RouteTable

RouteTable()

The set of routes registered on an application.

Constructor

new RouteTable()

Source:

Classes

RouteTable

Members

routes :Map.<string, {pattern: string, matcher: RegExp, methods: Map.<string, object>}>

Type:
  • Map.<string, {pattern: string, matcher: RegExp, methods: Map.<string, object>}>
Source:

Methods

allowedMethods(pathname) → {Array.<string>|null}

List the methods allowed on a concrete path.

OPTIONS is always allowed, and HEAD is allowed wherever GET is.

Parameters:
Name Type Description
pathname string

Request path

Source:
Returns:

Allowed methods, or null when the path is unowned

Type
Array.<string> | null

describe() → {Array.<{path: string, methods: Array.<string>, summary: string}>}

Render the registry as the routes member of a service description.

Source:
Returns:

Route descriptions

Type
Array.<{path: string, methods: Array.<string>, summary: string}>

find(pathname) → {object|undefined}

Find the route entry owning a concrete path.

Parameters:
Name Type Description
pathname string

Request path

Source:
Returns:

Route entry, or undefined when unowned

Type
object | undefined

register(method, pattern, metaopt) → {void}

Register a method on a path.

Parameters:
Name Type Attributes Description
method string

HTTP method

pattern string

Path pattern

meta object <optional>

Description metadata for ยง9

Source:
Returns:
Type
void