A Router object represents the handling of routing and middleware (such as httpGET(), httpPUT(), httpPOST(), and so on). Once a Router object is instantiated, middleware and HTTP method routes can be added. The top level Beakr object initializes with the creation of a Router object.

Fields

middleware

A list of specified middleware function or functions.

listeners

A list of specified listeners.

Methods

addMiddleware(middlware)

A method to add middleware function(s) to middleware.

addListener(listener)

A method to add listeners to listeners.

processEvent(event, ...)

Processes the event heard by the Listener.

invoke(req, websocket_msg, websocket_binary)

This method is used to create the request-response cycle objects of the provided middleware.

See also

Methods

Public methods


Method addMiddleware()

Usage

Router$addMiddleware(middleware)


Method addListener()

Usage

Router$addListener(listener)


Method processEvent()

Usage

Router$processEvent(event, ...)


Method invoke()

Usage

Router$invoke(req, websocket_msg = NULL, websocket_binary = NULL)


Method clone()

The objects of this class are cloneable with this method.

Usage

Router$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.