lib/rhapsody/router/modelRouter/index.js
function getModel(req, res, next, model) {
		var fullModel = Rhapsody.requireModel(model, true);

		if(!fullModel) {
			Rhapsody.log.verbose('Nonexistent model', 'Couldn\'t find collection %s.', model);
			return responseUtils.respond(res, 400); //Malformed syntax or a bad query
		}

		//This model does not allow REST API
		if(!fullModel.options.allowREST) {
			return responseUtils.respond(res, 404);
		}

		req.fullModel = fullModel;

		next();
	}
function getModel(req, res, next, model) {
		var fullModel = Rhapsody.requireModel(model, true);

		if(!fullModel) {
			Rhapsody.log.verbose('Nonexistent model', 'Couldn\'t find collection %s.', model);
			return responseUtils.respond(res, 400); //Malformed syntax or a bad query
		}

		//This model does not allow REST API
		if(!fullModel.options.allowREST) {
			return responseUtils.respond(res, 404);
		}

		req.fullModel = fullModel;

		next();
	}
function getModel ( req , res , next , model ) { var fullModel = Rhapsody . requireModel ( model , true ) ; if ( ! fullModel ) { Rhapsody . log . verbose ( 'Nonexistent model' , 'Couldn\'t find collection %s.' , model ) ; return responseUtils . respond ( res , 400 ) ; //Malformed syntax or a bad query } //This model does not allow REST API if ( ! fullModel . options . allowREST ) { return responseUtils . respond ( res , 404 ) ; } req . fullModel = fullModel ; next ( ) ; }
Gets the model and save it in the req object
@param  {ExpressRequest}   req
@param  {ExpressResponse}   res
@param  {Function} next Pass to the next route
Gets the model and save it in the req object