I'm trying to put a fetch inside a promise, so that I can use it in a Promise.all
let dbconnect = new Promise((rs, rj)=> {
console.log('dbconnect');
require('mongodb').MongoClient.connect("mongodb://localhost:27017/mydb", { useNewUrlParser: true } )
}),
call = new Promise((rs, rj) =>{
console.log('fetch');
fetch(link)})
});
Promise.all( [dbconnect, call] ).then...
Both calls get responses, but it doesn't trigger the Promise.all().then
, what am I doing wrong?