Classes

RouterReducerWrapper

Typedefs

Resolver : function
BotPath : Object
Middleware : Resolver | string | RegExp | Router | BotPath

flow control statement or function

 

Router ⇐ ReducerWrapper

Kind: global class
Extends: ReducerWrapper

 

new Router()

Cascading router

 

router.use(...resolvers) ⇒ this

Appends middleware, action handler or another router

Kind: instance method of Router
Params

Example

// middleware
router.use((req, res, postBack) => Router.CONTINUE);

// route with matching regexp
router.use(/help/, (req, res) => {
    res.text('Hello!');
});

// route with matching function (the function is considered as matcher
// in case of the function accepts zero or one argument)
router.use('action', req => req.text() === 'a', (req, res) => {
    res.text('Hello!');
});

// use multiple reducers
router.use('/path', reducer1, reducer2);
 

Router.CONTINUE

Return Router.CONTINUE when action matches your route Its same as returning true

Kind: static property of Router
Properties

Type
boolean
 

Router.BREAK

Return Router.BREAK when action does not match your route Its same as returning false

Kind: static property of Router
Properties

Type
boolean
 

Router.END

Returning Router.END constant stops dispatching request Its same as returning undefined

Kind: static property of Router
Properties

Type
null
 

Resolver : function

Kind: global typedef
Params

  • [req] Request
  • [res] Responder
  • [postBack] function
 

BotPath : Object

Kind: global typedef
Properties

Name Type
path string
 

Middleware : Resolver | string | RegExp | Router | BotPath

flow control statement or function

Kind: global typedef

results matching ""

    No results matching ""