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.
middleware
A list of specified middleware function or functions.
listeners
A list of specified listeners.
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.
addMiddleware()
Router$addMiddleware(middleware)
addListener()
Router$addListener(listener)
processEvent()
Router$processEvent(event, ...)
invoke()
Router$invoke(req, websocket_msg = NULL, websocket_binary = NULL)
clone()
The objects of this class are cloneable with this method.
Router$clone(deep = FALSE)
deep
Whether to make a deep clone.