Permalink
Browse files

Stop the server if MongoDB is not started

  • Loading branch information...
1 parent 709d7a9 commit e61f0aebde0bd5420fc44eee71973a6a69bdfe14 @fzaninotto committed Jan 13, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 bootstrap.js
View
@@ -6,7 +6,8 @@ var semver = require('semver')
mongoose.connect(config.mongodb.connectionString || 'mongodb://' + config.mongodb.user + ':' + config.mongodb.password + '@' + config.mongodb.server +'/' + config.mongodb.database);
mongoose.connection.on('error', function (err) {
console.error('MongoDB error: ' + err.message);
- console.error('Make sure a mongoDB server is running and accessible by this application')
+ console.error('Make sure a mongoDB server is running and accessible by this application');
+ process.exit(1);
});
mongoose.connection.on('open', function (err) {
mongoose.connection.db.admin().serverStatus(function(err, data) {

0 comments on commit e61f0ae

Please sign in to comment.