Class: module:services/route-builder

module:services/route-builder(attrs)

Factory class for building a BaseService route object. This class is useful in complex collections of service classes, when the URL is built conditionally.

Patterns based on path-to-regex may obviate the need for this, though they haven't done so yet.

Constructor

new module:services/route-builder(attrs)

Parameters:
Name Type Description
attrs object

Refer to individual attributes

Properties
Name Type Description
base string

Base URL, defaults to ''

Source:

Members

format

Get the format components separated by '/'.

Source:

Methods

push(format, capture) → {object}

Saves the format and capture values in the RouteBuilder instance.

Parameters:
Name Type Description
format string

Pattern based on path-to-regex, for example: (?:(.+)\\.)?${serviceBaseUrl}

capture string

Value to capture

Source:
Returns:

RouteBuilder instance for chaining

Type
object

toObject() → {Object}

Returns a new object based on RouteBuilder instance containing its base, format and capture properties.

Source:
Returns:

Object containing base, format and capture properties of the RouteBuilder instance

Type
Object