You can override another Promise from a library like node-fetch
with bluebird.
var fetch = require("node-fetch");
var Bluebird = require("bluebird");
fetch.Promise = Bluebird;
const url = "https://reqres.in/api/users?page=2"
Bluebird.config({
longStackTraces: true,
warnings: true
})
function customFunction(customUrl) {
return fetch(customUrl)
.then(res => res.json())
.then(json => {
console.log('Fresh data here!')
return json
});
}
customFunction(url)
.then(response => {
console.log('response', response)
})