Class: Route

amiwo/rest~ Route


new Route()

Source:

Methods


activateDebug()

Express compatible middleware to activate the debug mode for that route until the next call.
Superseeds original config file (thus preventing to have to relaunch the server to modify config options)

Parameters:
Name Type Description
req.*.debug Boolean | String
Source:

getPerformanceMonitorTimer(req [, del])

Get the PerformanceMonitor timer associated with this Route

Parameters:
Name Type Argument Default Description
req Express.Request
del Boolean <optional>
true

set to true to delete the ID from the Session Request object and the associated PerformanceTimer

Source:
Returns:

timer's timestamp

Type
Number

getPerformanceMonitorTimerId(req [, delId])

Get the PerformanceMonitor timer ID associated with this Route from the Session request object

Parameters:
Name Type Argument Default Description
req Express.Request
delId Boolean <optional>
true

set to true to delete the ID from the Session Request object

Source:
Returns:
Type
String

init()

Create routes

Parameters:
Type Description
any
Source:

keepMethod(authorizedMethods)

Allow HTTP methods matching 'authorizedMethods' to be executed and block others

Parameters:
Name Type Description
authorizedMethods String
Source:

log(parameters)

Display log informations on 'parameters'

Parameters:
Name Type Description
parameters String | Array.<String>

: list of expected parameters ("body" to list the parameters from req.body)

Source:
Returns:

Express compatible (req, res, next) middleware

Type
function

parallel(middleware:)

Return an Express compatible middleware that will asynchronuously calls all the middlewares passed as argument and that will be completed once all middlewares are resolved.
If any of the middleware fails (i.e., calls next(Error)), this middleware will be rejected with the Error of the first middleware that was rejected.

Parameters:
Name Type Description
middleware: function

a middleware that takes req, res, next as parameter

Source:
Returns:

an Express compatible middleware

Type
function

setSession()

Set the current Session object for this Route

Source:

startPerformanceMonitorTimer()

Generic middleware to start PerformanceMonitor's timer and save id in Session's Request object

Source: