Note: the api Key is fake for privacy.
const url = 'http://newsapi.org/v2/everything?' +
'q=platformer&' +
'apiKey=3ce15c4d1fd3485cbcf17879bab498db';
async function getNews() {
const response = await fetch(url);
const data = await response.json();
console.log(data);
}
getNews()
The problem is that when I run this javascript code I get this error:
Access to fetch at 'http://newsapi.org/v2/everything?q=platformer&apiKey=3ce15c4d1fd3485cbcf17879bab498db' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Basically I want to pull news from this newsapi.org and and see the data in the console.