Skip to content

Commit ce2ee23

Browse files
committed
fix(server): only require models if they are coffescript or js files
closes #75
1 parent 5d69333 commit ce2ee23

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: templates/express/server.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ var db = mongoose.connect(config.mongo.uri, config.mongo.options);
2121
// Bootstrap models
2222
var modelsPath = path.join(__dirname, 'lib/models');
2323
fs.readdirSync(modelsPath).forEach(function (file) {
24-
require(modelsPath + '/' + file);
24+
if (/(.*)\.(js$|coffee$)/.test(file)) {
25+
require(modelsPath + '/' + file);
26+
}
2527
});
2628

2729
// Populate empty DB with sample data

0 commit comments

Comments
 (0)