I'm trying to get some data from an API using fetch, and the console log shows [], however, when I do the same request using Postman, it successfully returns a JSON. What am I doing wrong?
let fetch = require("node-fetch");
const url_deals = 'http://www.cheapshark.com/api/1.0/deals';
function getDealInfo(dealID){
let new_url = new URL(url_deals + "?id=" + dealID);
fetch(new_url, {method : 'GET'})
.then(data =>{
data.json().then(out => {
console.log(out);
})
})
}
getDealInfo("X8sebHhbc1Ga0dTkgg59WgyM506af9oNZZJLU9uSrX8%253D");
