flatiron/flatiron — Issue #19: Possible to merge route table into app.router?
Author: ryan-blunden
Created: 2012-01-26 18:59:51+00:00
State: open

So the documentation for using Director in Flatiron is not clear at all. The docs provide examples of a route table but no way to use a route table once you're using flatiron.app and the flatiron.plugins.http.

What I'm trying to achieve is using app.router with a route table like the below as I'm very intrigued by the possibility of using multiple response handlers for a single request.

var routes = {
'/authors': {
on: showAuthor,
'/books': { on: [showCover, showDescription] },
'/bios': { on: [showPicture, showBiography] }
}
};

Adhoc syntax support for this would also be great.
app.router.get('/user/:id', [function(){ /* show photo */}, function(){ /* get contacat details */}]);

It's clear how to do this if you're setting up router from scratch but because there is already an instance ready to go on app.router, it's not clear how to merge a route table in.