Permalink
Browse files

Add collbacks error with connecton db

  • Loading branch information...
Nyweron committed Jun 28, 2017
1 parent 4b75ab1 commit 00693b7d1b6eb6bd5b53c406992ceaa7012e890d
Showing with 13 additions and 0 deletions.
  1. +13 −0 db.js
13 db.js
@@ -1,6 +1,19 @@
var mongoose = require('mongoose')
var url = process.env.MONGODB_URI || 'mongodb://localhost/socialLocalhost'
// When successfully connected
mongoose.connect(url, function() {
console.log('mongodb connected')
})
// If the connection throws an error
mongoose.connection.on('error', function(err) {
console.log('Mongoose default connection error: ' + err);
});
// When the connection is disconnected
mongoose.connection.on('disconnected', function() {
console.log('Mongoose default connection disconnected');
});
module.exports = mongoose

0 comments on commit 00693b7

Please sign in to comment.