You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varusers={show: function(req,res){//do something},me: function(req,res){//do something},load : function(id,fn){User.findById(id,fn);}};varuserResource=app.resource('users',users);userResource.map('get','me',users.me)//expecting /users/me to do something
That doesn't work. It seems to think that "me" is the ID and passes it to load, thinking it's going to invoke show. In fact, I don't know how it would know any better. So I'm thinking there's no way to do custom collection actions; you can only do custom member actions.
So first off, is that right? If so, is this something I should patch?
The text was updated successfully, but these errors were encountered:
I found that it's priority problem of register, I have just a temporary solution. modify the sourcecode
//default actions
for (var i=0, key; i < orderedActions.length; i++) {
key = orderedActions[i];
if (actions[key]) this.mapDefaultAction(key, actions[key]);
}
to
//default actions
_this = this;
setTimeout(function() {
for (var i=0, key; i < orderedActions.length; i++) {
key = orderedActions[i];
if (actions[key]) _this.mapDefaultAction(key, actions[key]);
}
}, 1000);
The purose of modification is delayed loading default actions, and loading custom router at first. You can change the setTimeout time according to the actual.
Suppose I've done something like:
That doesn't work. It seems to think that "me" is the ID and passes it to
load
, thinking it's going to invokeshow
. In fact, I don't know how it would know any better. So I'm thinking there's no way to do custom collection actions; you can only do custom member actions.So first off, is that right? If so, is this something I should patch?
The text was updated successfully, but these errors were encountered: