registerRoute

Summary

The method to override to associate the controller with a route.

Usage

public abstract void registerRoute()

Description

Override this method to provide isolated code for route registration. This isolated method enables clean separation of test code. In your test code, routes should not be registered; thus, this method should not be called during testing even if it is overridden.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import Altitude.Frontend;
import Altitude.Frontend.RouteEngines;
 
class CustomersController : Controller
{
    public override void registerRoute(IRouter router) {
        router.registerRoute("customers", this.view.show, this.view.hide);
    }
 
    // ...
}
 
// Instantiate a WebBrowserRouter for browser-based routing
WebBrowserRouter router = new WebBrowserRouter();
router.listenEvents();
 
// Instantiate the controller and register the route
CustomersController controller = new CustomersController();
controller.registerRoute(router);

Share

HTML | BBCode | Direct Link