mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 06:32:39 +00:00
Both types of tests are now working
This commit is contained in:
@@ -6,13 +6,18 @@ const dbPath = process.env.MONGODB_URI || process.env.MONGOLAB_URI || 'mongodb:/
|
||||
module.exports = {
|
||||
connect : ()=>{
|
||||
return new Promise((resolve, reject)=>{
|
||||
mongoose.createConnection(dbPath,
|
||||
if(mongoose.connection.readyState == 1){
|
||||
console.log('already connected');
|
||||
return resolve();
|
||||
}
|
||||
mongoose.connect(dbPath,
|
||||
(err) => {
|
||||
if(err){
|
||||
console.log('Error : Could not connect to a Mongo Database.');
|
||||
console.log(' If you are running locally, make sure mongodb.exe is running.');
|
||||
return reject(err);
|
||||
}
|
||||
console.log('mongo connected.');
|
||||
return resolve();
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user