Created
April 13, 2020 10:47
-
-
Save sdejean28/cbb5c4bbc69a41d68e1feb2db68ff2b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MSSQL init | |
const promise_mssql = new Promise((_resolve, _reject) => { | |
notifier.on('mssql_connected', () => { | |
_resolve(); | |
}) | |
}); | |
const { mongoose } = require("./mongodb.js"); | |
// MongoDB init | |
const promise_mongodb = new Promise((_resolve, _reject) => { | |
notifier.on('mongodb_connected', () => { | |
_resolve(); | |
}) | |
}); | |
// and wait for all to initialize | |
Promise.all([promise_mssql, promise_mongodb]).then( | |
function() { | |
console.log('Connected to all databases !'); | |
notifier.emit('start_process'); | |
},function(err) { | |
console.log('Promise.all error',err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment