Skip to content
hij1nx edited this page Sep 11, 2011 · 1 revision

proposal

the constructor should allow the centralization of the routing table.

var router = new Router({
  '/foo': fooLogic
});

the constructor's routing table should allow definition nesting for terseness.

var router = new Router({
  '/foo': {
    '/bar': barLogic
    '/bazz': bazzLogic 
  }
});

the constructor's routing table should allow named events to be associated with routing segments

var router = new Router({
  '/foo': {
    '/bar': barLogic
    '/bazz': bazzLogic 
    on: fooOn
    after: fooAfter
  }
});

the constructor's routing table should allow event types to be associated with routing segments

var router = new Router({
  '/foo': {
    '/bar': barlogic // no event type specified, synonymous with GET
    '/bazz':
    get: fooGetLogic,
    post: fooPostLogic,
    on: fooLogic // on synonymous with GET
  }
});

the instance should allow for ad-hoc routing.

var router = new Router();
router.routes('/foo', function() {

  this.route('/bar', function() { ... });
  this.route('/bazz', function() { 
    this.route('bla', function() { ... });
  });

});

Discussion

hij1nx

the above is directly taken from the current work found in sugarskull.js