node-restful icon indicating copy to clipboard operation
node-restful copied to clipboard

Expose CRUD operations

Open baugarten opened this issue 12 years ago • 0 comments

Expose common CRUD operations to user defined routes through

model = restful.model(...)
model.route('anotherget', {
    detail: true,
    handler: function(req, res, next) {
        model.get(req.params.id, function(err, model) {..}) 
        model.post(req.params.id, { data: value }, function(err, model) {..});
    }
});

Stupid example, but this could be useful

baugarten avatar Mar 30 '13 06:03 baugarten