loader.js
function init(pathToModels, cb, addToSwagger) {
	modelPath = pathToModels;
	glob(modelPath + '/**/*.js', function(err, files) {
		if (err) return cb && cb(err);

		files.forEach(function(file) {
			var Model = require(file)(),
				modelSwagger = null;

            if (Model.init) {
                Model.init();
            }

            modelSwagger = Model.getSwagger();
            
			if (modelSwagger && addToSwagger) {
				modelSwagger.forEach(function(swaggerResource) {
					swagger[swaggerMethodName[swaggerResource.spec.method.toLowerCase()]](swaggerResource);
				});
			}
			models.push(Model);
		});

		return cb && cb(null, models);
	});
}
function init(pathToModels, cb, addToSwagger) {
	modelPath = pathToModels;
	glob(modelPath + '/**/*.js', function(err, files) {
		if (err) return cb && cb(err);

		files.forEach(function(file) {
			var Model = require(file)(),
				modelSwagger = null;

            if (Model.init) {
                Model.init();
            }

            modelSwagger = Model.getSwagger();
            
			if (modelSwagger && addToSwagger) {
				modelSwagger.forEach(function(swaggerResource) {
					swagger[swaggerMethodName[swaggerResource.spec.method.toLowerCase()]](swaggerResource);
				});
			}
			models.push(Model);
		});

		return cb && cb(null, models);
	});
}
function init ( pathToModels , cb , addToSwagger ) { modelPath = pathToModels ; glob ( modelPath + '/**/*.js' , function ( err , files ) { if ( err ) return cb && cb ( err ) ; files . forEach ( function ( file ) { var Model = require ( file ) ( ) , modelSwagger = null ; if ( Model . init ) { Model . init ( ) ; } modelSwagger = Model . getSwagger ( ) ; if ( modelSwagger && addToSwagger ) { modelSwagger . forEach ( function ( swaggerResource ) { swagger [ swaggerMethodName [ swaggerResource . spec . method . toLowerCase ( ) ] ] ( swaggerResource ) ; } ) ; } models . push ( Model ) ; } ) ; return cb && cb ( null , models ) ; } ) ; }
gets all model files and adds them to swagger
it will then add those to swagger as the proper resource

@author Tim Golen 2014-12-17

@param  {Function} cb
gets all model files and adds them to swagger it will then add those to swagger as the proper resource