0

I have a create-react-app small project and I am trying to fetch from an yaml downloaded from SwaggerHubfile and I can't figure it out.

The structure of the project is as in the image: enter image description here

I am trying to acces something that looks like this:

paths:

/users/jobs/list:

So far I tried this:

function getData () {
        fetch("http://localhost/3000/data.json")
            .then(data => data.json())
            .then(resp => console.log(resp));
    }

    getData();

but it doesn't work. What can I do to fetch data from an yaml file? Or can I fetch straight from SwaggerHub by using just the url?

code_dude
  • 951
  • 2
  • 15
  • 28
  • Is 3000 the port number? If so, change `localhost/3000` to `localhost:3000`. Does this resolve the issue? – Helen Oct 29 '22 at 09:30

0 Answers0