flatiron/director — Issue #71: http routing recurse doesn't work
Author: alexindigo
Created: 2012-01-12 05:32:25+00:00
State: open

Either settings 'backword' or 'forward' don't work in http routing.
+ in the docs it said for http routing 'backward' is default value,
although code says differently:
https://github.com/flatiron/director/blob/master/lib/director/http/index.js#L30

My env:

$ node -v
v0.6.6
$ npm list
├── director@1.0.8

Example code:
-----8<----------
var http = require('http'),
director = require('director');

var router = new director.http.Router(
{
'/hello':
{
'/hello2':
{
get: function(route)
{
this.res.write('hello2\n');
}
},
get: function(route)
{
this.res.write('hello\n');
}
}
}).configure(
{
recurse: 'backward',
before: function(){ this.res.writeHead(200, { 'Content-Type': 'text/plain' }); },
on: function(){ this.res.end(); }
});

var server = http.createServer(function (req, res) {
router.dispatch(req, res, function (err) {
if (err) {
res.writeHead(404);
res.end();
}
});
});

server.listen(8080);
-----8<----------