API Requests fail about npm run build on my Flask App

  Kiến thức lập trình

I made an app using flask and react. There are frequent api calls I make to the backend. I used axios.

My issue is that my API calls are failing and I am unable to extract data from the backend to frontend. The only information I get is this insane long text:
<!doctype html>React AppYou need to enable JavaScript to run this app.

When I tested it on localhost, it worked as intended.
For example, if I click a button to generate a string, it generates a string. However, after running ‘npm run build’ and ‘serve -s build’ on terminal, if I do the same thing on the localhost, it prints out this:

This is exactly what’s on my index.html in my build directory. I have no idea why this is printing every time or why my API call to the backend is failing despite the code not changing. See images for reference

Can someone tell me what is going on?

If you are confused, I’ll try to clarify
Thank you

New contributor

Akhil Gogineni is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT