axios.post Fails in App, Works in URL

Viewed 406

I'm following a React-Redux tutorial. My axios.post() is failing when running the app, but if I use that same URL and paste it into the browser's address textbox it works. Why would that happen?

Here is the call in my app:

const request = axios.post(`${ROOT_URL}/posts/${id}${API_KEY}`);

Here is the error, as shown in F12 in Chrome:

POST http://reduxblog.herokuapp.com/api/posts/120342?key=bob884 404 (Not Found)

Why would that fail when it's a good URL? If you click it, you'll see the response in the browser:

{"id":120342,"title":"SOLID","categories":"OOP","content":"SOLID is an acronym..."}

1 Answers
Related