Merge pull request #100 from cmgustavo/bug/01message-connect-mongodb

check if mongod is running. show a message.
This commit is contained in:
Mario Colque 2014-01-21 05:53:38 -08:00
commit 64975df5f0
1 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,16 @@ var express = require('express'),
var config = require('./config/config');
//Bootstrap db connection
// If mongod is running
mongoose.connection.on('open', function (ref) {
console.log('Connected to mongo server.');
});
// If mongod is not running
mongoose.connection.on('error', function (err) {
console.log('Could not connect to mongo server!');
console.log(err);
});
mongoose.connect(config.db);
//Bootstrap models