-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
It would be pretty cool to make restifyMongoose
resource support custom model methods and improove restifyMongoose::serve
function to automatically generate api endpoint for those methods.
For example:
When we have model...
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const _schema = new Schema({
title: String,
toggle: { type: Boolean, default: false }
});
_schema.methods.switch = function () {
this.toggle = !this.toggle;
this.save();
};
var Toggler = mongoose.model('Toggler', _schema);
... it would be great to generate endpoint /Toggler/:id/switch
wich will call appropriate method.
Manghud and Kaakati
Metadata
Metadata
Assignees
Labels
No labels