Stuart,
It is very possible to do this:
var router = new director.http.Router();
//
// Router treats the request as unhandled
//
router.get('/', function (next) {
next();
});
//
// Router responds with an error to the next middleware
//
router.get('/', function (next) {
next(new Error('OHAI I'm an error');
});
It's worth noting that the `next` callback always comes after any capture groups in the routing table:
e.g.
//
// Setup a router path with a regexp and capture group
//
router.path(/\/(\w+)/, function () {
//
// Then setup a second regexp and capture group
//
router.get(\/(\w+)/, function (outerCapture, innerCapture, next) {
//
// ***Notice there are two parameters before next***
//
});
});
Cheers,
Charlie