Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

docs for (req, id, callback) sig

  • Loading branch information...
commit 1b4b59d20ead6ddabaffd1a740b0d8409102db96 1 parent edbb4d4
@tj tj authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 Readme.md
View
6 Readme.md
@@ -84,7 +84,13 @@ Resources have the concept of "auto-loading" associated data. For example we can
User.load = function(id, fn) {
fn(null, users[id]);
};
+
+ // or
+ User.load = function(req, id, fn) {
+ fn(null, users[id]);
+ };
+
app.resource('users', { show: ..., load: User.load });
With the auto-loader defined, the `req.user` object will be available now be available to the actions automatically. We may pass the "load" option as the third param as well, although this is equivalent to above, but allows you to either export ".load" along with your actions, or passing it explicitly:
Please sign in to comment.
Something went wrong with that request. Please try again.