Skip to content

Commit

Permalink
fix(server): only require models if they are coffescript or js files
Browse files Browse the repository at this point in the history
closes #75
  • Loading branch information
DaftMonk committed Feb 2, 2014
1 parent 5d69333 commit ce2ee23
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion templates/express/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ var db = mongoose.connect(config.mongo.uri, config.mongo.options);
// Bootstrap models
var modelsPath = path.join(__dirname, 'lib/models');
fs.readdirSync(modelsPath).forEach(function (file) {
require(modelsPath + '/' + file);
if (/(.*)\.(js$|coffee$)/.test(file)) {
require(modelsPath + '/' + file);
}
});

// Populate empty DB with sample data
Expand Down

0 comments on commit ce2ee23

Please sign in to comment.