Merge pull request #100 from cmgustavo/bug/01message-connect-mongodb
check if mongod is running. show a message.
This commit is contained in:
commit
64975df5f0
10
server.js
10
server.js
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue