Not able to connect my React app to WordPress API? What am I performing incorrect?

I have hosted a wordpress site on my localhost on a selected port variety. Allows call that port quantity xxxx. When I open my browser and variety

http://localhost:xxxx

I am ready to access the main home site of my wordpress internet site and I can see my posts over there.

So obviously its working.

Now in my react app, I am working with axios.get to hook up to that page and endeavor to get the posts in JSON format.

So I’m typing in:

axios.get(‘http://localhost:xxxx/index.php/wp-json’).then(res=>console.log(res)).catch(err=>console.log(err))

I am obtaining a ” AxisError Community Error “.

But the interesting matter is, when I try out one more area file path URL, I as a substitute get a ” 404 not observed mistake “.

What could be triggering this? Why is my respond application not in a position to join to localhost:xxxx? Is there some thing wrong with my url?