Core/Router

App router. It extends the standard Backbone.js router.

The router manages the watching of the address hash and routes to the correct handler. You need to add your routes with their callback using addRoutes method. To add your routes, you have to listen to the router:init event.

Example:

const Events = require('./events');
Events.on('router:init', function(router) {
    var routes = [
        {
            route: 'MyModule/my_custom_route',
            name: 'MyModule',
            callback: MyModule
        }
    ];
    SUGAR.App.router.addRoutes(routes);
});