Last active
August 29, 2015 14:22
-
-
Save keon/23edd15c1c6ba0e74c96 to your computer and use it in GitHub Desktop.
load all files in selected directory in javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load all files in models dir | |
fs.readdirSync(__dirname + '/app/models').forEach(function(filename){ | |
if (~filename.indexOf('.js')) require(__dirname + '/app/models/' + filename) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment