lib/controllers/static-method.js
function callStaticMethod(methodName, req, res, next) {
  res.__apiMethod = 'staticMethod';
  res.__apiStaticMethod = methodName;
  var self = this;
  var methodOptions = this.apiOptions.exposeStatic[methodName] || {};

  var wrapper = methodOptions.exec;
  if (!(wrapper instanceof Function)) wrapper = null;

  var httpMethod = methodOptions.method || 'post';
  var params = (httpMethod !== 'get') ? req.body : req.query;

  var mFunc = wrapper || this.model[methodName];

  mFunc.call(this.model, params, function(err, result) {
    if (err) return next(err);
    res.json(result);
  });
}
function callStaticMethod(methodName, req, res, next) {
  res.__apiMethod = 'staticMethod';
  res.__apiStaticMethod = methodName;
  var self = this;
  var methodOptions = this.apiOptions.exposeStatic[methodName] || {};

  var wrapper = methodOptions.exec;
  if (!(wrapper instanceof Function)) wrapper = null;

  var httpMethod = methodOptions.method || 'post';
  var params = (httpMethod !== 'get') ? req.body : req.query;

  var mFunc = wrapper || this.model[methodName];

  mFunc.call(this.model, params, function(err, result) {
    if (err) return next(err);
    res.json(result);
  });
}
function callStaticMethod ( methodName , req , res , next ) { res . __apiMethod = 'staticMethod' ; res . __apiStaticMethod = methodName ; var self = this ; var methodOptions = this . apiOptions . exposeStatic [ methodName ] || { } ; var wrapper = methodOptions . exec ; if ( ! ( wrapper instanceof Function ) ) wrapper = null ; var httpMethod = methodOptions . method || 'post' ; var params = ( httpMethod !== 'get' ) ? req . body : req . query ; var mFunc = wrapper || this . model [ methodName ] ; mFunc . call ( this . model , params , function ( err , result ) { if ( err ) return next ( err ) ; res . json ( result ) ; } ) ; }
callStaticMethod - controller that calls a static method of model

@param  {String}           methodName the name of method that should be called
@param  {express.Request}  req        the http(s) request
@param  {express.Response} res        the http(s) response
@param  {Function}         next       the callback should be called if controller fails

@memberof ModelAPIRouter
callStaticMethod - controller that calls a static method of model