APIs forever (with problems)

A

Anonymous

Guest
Hello,
My intention was to focus on frontend dev., now I stuck with API requests (no data -> no frontend)

I was about to build up a small app with the data of the yahoo finance API. Here I have a problem with CORS.
Even a CORS proxy (see below) does not work.

Ok, taking a step back, I chose https://dummyapi.io/ in order to practice the whole thing.
When I don’t have problems with CORS here, I cannot access the JSON data,

Here is the basic code that I used for dummyapi:

Code:
const url =
  "https://cors-anywhere.herokuapp.com/https://n161.tech/api/dummyapi/user?limit=5&page1";

fetch(url)
  .then((res) => {
    console.log(res);
    return res.json();
  })
  .then((data) => {
    console.log(data);
  });

The CORS proxy actually works, however, I think I don't have JSON data on the other side, it's HTML.

error: index.html:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

Does anybody have a hint how to approach this whole thing? (Honestly speaking I would be happy to have a black box where I can send my AJAX requests, fetch my data and focus on the fronent dev. But life is not so easy!)
 
Back
Top