visionmedia / express-resource

Resourceful routing for Express
1.41k stars 140 forks source link

Access resource and action name from request handler #65

Open reaktivo opened 12 years ago

reaktivo commented 12 years ago

Is there a way to to access the resource name and/or action from inside the request handler? e.g.

// app.js
app.resource('user', require('./users.js'));
// users.js
exports.index = function(req, res) {
  var resource = req.resource;
  var action = req.action;
  res.render(resource + "/" + action);
}