Router

Extends

Route

Router specific Route constructor

Type:
function
new Router(options)

Holds Route definition objects which have common part of a url path

Parameters:
  • options
    • Type: Object
      • routeNameFormat optional
        • Type: String
        • will be used to format route UID string. Should contain placeholders: {method} & {name} {version}

      • version optional
        • Type: String
        • will be part of route path

      • url
        • Type: String
        • relative endpoint

Fires:
buildRoute(options)RouteInterface

creates new Route object

Parameters:
  • options
    • Type: Object
      • name
        • Type: String
      • type
        • Type: String
      • url
        • Type: String
Fires:
Returns: RouteInterface
getUrl()String

returns absolute path the router is binded to

Returns: String
setRouteNameFormat(format)undefined
Parameters:
  • format
    • Type: String
Returns: undefined
Example:
router.setRouteNameFormat('{method}{Name}_{version}');
build-route

emitted with each Router#buildRoute method call.

Properties:
comments powered by Disqus