Im using Node.js and TypeScript to try and use an api that returns a JSON.
When i click on the link in my browser it works perfectly fine, i can see the JSON file.
However, when i make a simple fetch request i get a CORS ERROR in my browser console. I tried to use { mode: 'no-cors' }, but then i dont have access to the body.
I checked my url and its fine.
can anyone tell me why is that?
my function:
async function fetchFeed() {
try {
const response = await fetch(`${BASIC_URL}`, {
})
console.log(response);
const posts = await response.json()
console.log(posts);
} catch (err) {
console.log('could note get posts' + err);
}
}