Skip to content

Instantly share code, notes, and snippets.

@radicaldrew
Created July 1, 2019 06:23
Show Gist options
  • Save radicaldrew/a7f17ec9517d7ad89f586dad7953e8cc to your computer and use it in GitHub Desktop.
Save radicaldrew/a7f17ec9517d7ad89f586dad7953e8cc to your computer and use it in GitHub Desktop.
const fs = require('fs');
module.exports = (app) => {
fs.readdirSync(__dirname).forEach( file => {
if (file === "index.js" || file.substr(file.lastIndexOf('.') + 1) !== 'js')
return;
let name = file.substr(0, file.indexOf('.'));
require('./' + name)(app);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment