add error of database connection
This commit is contained in:
parent
f9e7a866fd
commit
77dadf7e1c
1 changed files with 6 additions and 2 deletions
|
|
@ -2,8 +2,12 @@ const config = require('./config');
|
||||||
const mongoose = require( 'mongoose' );
|
const mongoose = require( 'mongoose' );
|
||||||
const url = config.mongodbHost;
|
const url = config.mongodbHost;
|
||||||
|
|
||||||
mongoose.connect(url,({useNewUrlParser: true, useUnifiedTopology: true}));
|
mongoose.connect(url,({useNewUrlParser: true, useUnifiedTopology: true})).then( function(){
|
||||||
console.log(mongoose.connection.readyState);
|
console.log('mongodb-message connected '+mongoose.connection.readyState);
|
||||||
|
}).catch(function(err){
|
||||||
|
console.log('error : '+err);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
const schemaMessage = mongoose.Schema({
|
const schemaMessage = mongoose.Schema({
|
||||||
username:{
|
username:{
|
||||||
|
|
|
||||||
Reference in a new issue