check if mongod is running. show a message.
This commit is contained in:
parent
99c04752cd
commit
11adc88651
10
server.js
10
server.js
@ -24,6 +24,16 @@ var express = require('express'),
|
|||||||
var config = require('./config/config');
|
var config = require('./config/config');
|
||||||
|
|
||||||
//Bootstrap db connection
|
//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);
|
mongoose.connect(config.db);
|
||||||
|
|
||||||
//Bootstrap models
|
//Bootstrap models
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user