I am having issues fetching data from an api from the client side. I have verified that you can get data from the api in node.js, python and by going to the url but I get an error when trying to access it from the client.
function fetchData(url) {
return fetch(url)
.then((res) => {return res.text()})
.catch((err) => console.log(err));
}
fetchData("Some url string").then((data) => console.log(data));
In node.js this allows me to get the response data but on the client page this returns an error.