Express's router allows for specifying callbacks when parameters are matched.
(http://expressjs.com/api.html)
That is a very useful feature because it allows you to define, for example, a function to retreive an object from the database upon route access, thus keeping code DRY.
Note how it keeps all the other functions clean, removing the necessity for initial database queries within the other route callbacks that need the article.
This same feature can be very useful if also added to crossroads.js.
this would increase complexity drastically since right now every single method on crossroads is synchronous.. I would only implement something like this for v2.0 release - if we decide to add async support (see #82)
Express's router allows for specifying callbacks when parameters are matched. (http://expressjs.com/api.html) That is a very useful feature because it allows you to define, for example, a function to retreive an object from the database upon route access, thus keeping code DRY.
This approach is used by Mean.js: https://github.com/meanjs/mean/blob/master/app/routes/articles.server.routes.js#L21 https://github.com/meanjs/mean/blob/master/app/controllers/articles.server.controller.js#L90
Note how it keeps all the other functions clean, removing the necessity for initial database queries within the other route callbacks that need the article.
This same feature can be very useful if also added to crossroads.js.