Skip to content

Instantly share code, notes, and snippets.

@keon
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keon/23edd15c1c6ba0e74c96 to your computer and use it in GitHub Desktop.
Save keon/23edd15c1c6ba0e74c96 to your computer and use it in GitHub Desktop.
load all files in selected directory in javascript
// 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