lib/routes/index.js
function (req, res, options) {
    if (!options) {
      options = {};
    }
    options.operation = 'REMOVE';
    options.res = res;
    if (!options) {
      options = {};
    }
    if (req.params.model) {
      options.model = req.params.model;
    }
    if (req.params.query) {
      options.query = req.params.query;
    }
    if (req.params.id) {
      options.query = {
        _id: req.params.id,
      };
    }
    exports.remove.before(req, res, options);
    var userId = req.session['user-id'];
    vulpejs.models.remove({
      model: options.model,
      item: {
        _id: req.params.id,
      },
      query: options.query,
      validate: options.validate || false,
      userId: userId,
      callback: {
        success: function (item) {
          if (!vulpejs.utils.execute(options.callback, {
              item: item,
              res: res,
            })) {
            exports.remove.after(req, res, item);
            res.json({
              item: item,
            });
          }
        },
        error: function (error) {
          exports.response.error(options, error);
        },
        validate: function (validate) {
          exports.response.validate(options, validate);
        },
      },
    });
  }
function (req, res, options) {
    if (!options) {
      options = {};
    }
    options.operation = 'REMOVE';
    options.res = res;
    if (!options) {
      options = {};
    }
    if (req.params.model) {
      options.model = req.params.model;
    }
    if (req.params.query) {
      options.query = req.params.query;
    }
    if (req.params.id) {
      options.query = {
        _id: req.params.id,
      };
    }
    exports.remove.before(req, res, options);
    var userId = req.session['user-id'];
    vulpejs.models.remove({
      model: options.model,
      item: {
        _id: req.params.id,
      },
      query: options.query,
      validate: options.validate || false,
      userId: userId,
      callback: {
        success: function (item) {
          if (!vulpejs.utils.execute(options.callback, {
              item: item,
              res: res,
            })) {
            exports.remove.after(req, res, item);
            res.json({
              item: item,
            });
          }
        },
        error: function (error) {
          exports.response.error(options, error);
        },
        validate: function (validate) {
          exports.response.validate(options, validate);
        },
      },
    });
  }
function ( req , res , options ) { if ( ! options ) { options = { } ; } options . operation = 'REMOVE' ; options . res = res ; if ( ! options ) { options = { } ; } if ( req . params . model ) { options . model = req . params . model ; } if ( req . params . query ) { options . query = req . params . query ; } if ( req . params . id ) { options . query = { _id : req . params . id , } ; } exports . remove . before ( req , res , options ) ; var userId = req . session [ 'user-id' ] ; vulpejs . models . remove ( { model : options . model , item : { _id : req . params . id , } , query : options . query , validate : options . validate || false , userId : userId , callback : { success : function ( item ) { if ( ! vulpejs . utils . execute ( options . callback , { item : item , res : res , } ) ) { exports . remove . after ( req , res , item ) ; res . json ( { item : item , } ) ; } } , error : function ( error ) { exports . response . error ( options , error ) ; } , validate : function ( validate ) { exports . response . validate ( options , validate ) ; } , } , } ) ; }
Remove object from database by id and callback if success.
@param {Object} req     Request
@param {Object} res     Response
@param {Object} options {model, id, callback}
Remove object from database by id and callback if success .