Created
November 21, 2016 21:57
-
-
Save jaredpalmer/a3029bbb6c17070520850c37683c902a to your computer and use it in GitHub Desktop.
require models dir
This file contains hidden or 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
const fs = require('fs') | |
const path = require('path') | |
const models = path.join(__dirname, 'models') | |
fs.readdirSync(models) | |
.filter(file => ~file.indexOf('.js')) | |
.forEach(file => require(path.join(models, file))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment