The Back Story
I am working on an app (source here) that uses flask for a backend api and react w/ react-router (using create-react-app) for the frontend. However, I haven't been able to get the devserver npm start
to proxy api requests to flask. After setting FLASK_APP From the project root I run:
flask run -h localhost -p 8000 --debugger
and in another terminal
cd frontend
npm start
The devserver opens a browser window and index.html
from react loads. The problem is that every rout that doesn't exist in the react app returns 404 including my backend api endpoints. The 404 message is not the same as the one flask usually returns and no backend requests are logged. I have set "propxy": "http://localhost:8000"
in package.json
. I am under the impression that this is supposed to proxy missing urls to localhost:8000
.
The Question
How do I get the webpack-dev-server to proxy api requests to my backend?