Skip to content

Instantly share code, notes, and snippets.

@jaredpalmer
Created November 21, 2016 21:57
Show Gist options
  • Save jaredpalmer/a3029bbb6c17070520850c37683c902a to your computer and use it in GitHub Desktop.
Save jaredpalmer/a3029bbb6c17070520850c37683c902a to your computer and use it in GitHub Desktop.
require models dir
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