code: function format(path) {
    var obj = require(path);
    return function(req, res){
      res.format(obj);
    };
  }
docs: or you could write a tiny middleware like this to add a layer of abstraction and make things a bit more declarative: