Docs - Dispatcher

The dispatcher is responsible for handling request and response, next to this, in raddish the dispatcher will also send the needed data to the controller.

Default behavior

Within the dispatcher it is the default behavior to send you to the controller having the same name as the component whenever there is no view name specified. This default behavior can be overridden with an object override or a component config value.

Also by default the dispatcher handles the user authentication. and it will search to the authenticator with the name default. This as well can be overridden in an object override or a component config value.

When for the controller and the authenticator only an name is given instead of a complete identifier, it will search for the object using the the identifier of the dispatcher.

Object Override:

copy
var Dispatcher  = require('raddish').Dispatcher;

class DemoDispacher extends Dispatcher {
    _initialize(config) {
        config.controller = 'foo';
        config.authenticator = 'bar';
        
        super._initialize(config);
    }
}

module.exports = DemoDispatcher;

Component Config:

copy
{
    "dispatcher": {
        "controller": "foo",
        "authenticator": "bar"
    }
}