Skip to content

Instantly share code, notes, and snippets.

@sdejean28
Created April 13, 2020 10:47
Show Gist options
  • Save sdejean28/cbb5c4bbc69a41d68e1feb2db68ff2b2 to your computer and use it in GitHub Desktop.
Save sdejean28/cbb5c4bbc69a41d68e1feb2db68ff2b2 to your computer and use it in GitHub Desktop.
// 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