lib/rhapsody/router/modelRouter/index.js
function bindMiddlewares() {
		var modelName,
			_this = this;

		for(modelName in Rhapsody.models) {

			(function(model) {

				model.options.middlewares.forEach(function(middleware) {
					if(typeof middleware !== 'function') {
						middleware = require(path.join(Rhapsody.root, '/app/middlewares/' + middleware));
					}

					modelName = '/' + modelName;

					_this.router.post(modelName, middleware);
					_this.router.post(modelName + '/:id/:relationship', middleware);
					_this.router.get(modelName + '/:id?', middleware);
					_this.router.get(modelName + '/:id/:relationship', middleware);
					_this.router.put(modelName + '/:id', middleware);
					_this.router.patch(modelName + '/:id', middleware);
					_this.router.delete(modelName + '/:id', middleware);
				});

			}(Rhapsody.models[modelName]));
		}
	}
function bindMiddlewares() {
		var modelName,
			_this = this;

		for(modelName in Rhapsody.models) {

			(function(model) {

				model.options.middlewares.forEach(function(middleware) {
					if(typeof middleware !== 'function') {
						middleware = require(path.join(Rhapsody.root, '/app/middlewares/' + middleware));
					}

					modelName = '/' + modelName;

					_this.router.post(modelName, middleware);
					_this.router.post(modelName + '/:id/:relationship', middleware);
					_this.router.get(modelName + '/:id?', middleware);
					_this.router.get(modelName + '/:id/:relationship', middleware);
					_this.router.put(modelName + '/:id', middleware);
					_this.router.patch(modelName + '/:id', middleware);
					_this.router.delete(modelName + '/:id', middleware);
				});

			}(Rhapsody.models[modelName]));
		}
	}
function bindMiddlewares ( ) { var modelName , _this = this ; for ( modelName in Rhapsody . models ) { ( function ( model ) { model . options . middlewares . forEach ( function ( middleware ) { if ( typeof middleware !== 'function' ) { middleware = require ( path . join ( Rhapsody . root , '/app/middlewares/' + middleware ) ) ; } modelName = '/' + modelName ; _this . router . post ( modelName , middleware ) ; _this . router . post ( modelName + '/:id/:relationship' , middleware ) ; _this . router . get ( modelName + '/:id?' , middleware ) ; _this . router . get ( modelName + '/:id/:relationship' , middleware ) ; _this . router . put ( modelName + '/:id' , middleware ) ; _this . router . patch ( modelName + '/:id' , middleware ) ; _this . router . delete ( modelName + '/:id' , middleware ) ; } ) ; } ( Rhapsody . models [ modelName ] ) ) ; } }
Bind the middlewares to the model routes
Bind the middlewares to the model routes