Action Router

The ActionRouter class is an extension of the main router, that handles actions that are functions accepting a Request object, a Response object, and a Server object argument respectively.
Copy

listeners

Returns a read-only shallow copy of the listeners. Listeners are organized by events and events can have multiple listeners and listeners have priorities. The listeners are not pre-organized by priority. This happens during the event loop.
Copy

routes

Returns all the routes that are registered with the router. You can use this to compare against the and properties for analytics and building production code. Routes are mapped like the following.
Copy

Example

Copy

all()

A shortcut for .

Usage

Copy

Example

Copy

connect()

A shortcut for .

Usage

Copy

Example

Copy

delete()

A shortcut for .

Usage

Copy

Example

Copy

emit()

Calls all the callbacks of the given event passing the given arguments.

Usage

Copy

Example

Copy

eventName()

Determines the event name given a method and path. This also sets the route in the routes map. This also sets the expression in the expressions map.

Usage

Copy
Copy

Example

Copy
Copy
Copy

get()

A shortcut for .

Usage

Copy

Example

Copy

head()

A shortcut for .

Usage

Copy

Example

Copy

on()

Adds an action callback to the given event listener.

Usage

Copy

Example

Copy

options()

A shortcut for .

Usage

Copy

Example

Copy

patch()

A shortcut for .

Usage

Copy

Example

Copy

post()

A shortcut for .

Usage

Copy

Example

Copy

put()

A shortcut for .

Usage

Copy

Example

Copy

route()

Registers a route with the router.

Usage

Copy

Example

Copy

trace()

A shortcut for .

Usage

Copy

Example

Copy

use()

Allows routes from other routers to apply here.

Usage

Copy

Example

Copy