tolicodes / hunt-mongoose-rest

Abstract Mongoose to REST interface CRUD
MIT License
0 stars 0 forks source link

Proposition for proxying request to statics and methods #3

Open vodolaz095 opened 10 years ago

vodolaz095 commented 10 years ago

Add proxying model instance and static methods mentioned in configuration

For example

POST /api/v1/posts/flush

will proxy request to function of static method of Active Record model


    request.model.Post.flush(request.user, request.body, function(error, someThing){...});

POST /api/v1/posts/123/subscribe

will proxy request to instance method function


    request.model.Post.findById('123', function(error, postFound){
      postFound.subscribe(request.user, request.body, function(error, someThing){...});
    });