Axios Get 404

Posted on  by admin
Hello everybody!I am a novice in ASP.NET and try to write my first application, whose client-size which is written in React.js, using this technology .

This is the simple SPA, which should send the data from its form and getting respomse. But every request ends up with the message ("Uncaught (in promise) Error: Request failed with status code 404") and I can't resolve this problem.Here is my FormComponent code:Controller API:And Comment Model:I can't get, what I'm doing wrong.

It seems to me it is very simple mistake, but I spendfor it a few hours and couldnt find any solution.

Thanl you in advance!!!!P.S. Sorry for my English.

Modified2 years, 4 months ago.

The React-Redux front end production server is running on port 3000 (localhost:3000).

oguz ismail
38.8k
5

However, axios always ignores the proxy values, and uses the client-side production build server, to make the api call to the express backend which sensibly returns a 404 error.

client-side package.json. The action creator:.

If any one can let me know if I'm actually tackling the problem, but my efforts just aren't fruitful, or I'm completely missing the point here. Referring to this post I think you can do the following.. After some testing on my app (same setup as above) and some reading, I found that this is a known issue with axios.

Velimir TchatchevskyVelimir Tchatchevsky
2,5271

Adrian BeloquiAdrian Beloqui. This implementation works:.

I found the adding the proxy config option as above resolved the 404 issue, but the validateStatus option doesn't affect the consequent 402 errors, which is can be easily resolved by changing what http status you return in your backend routes.

Not the answer you're looking for? Browse other questions tagged reactjsgoaxiosgo-gin or ask your own question.