Modify your folder structure so you have something like
your_project
| frontend ( your create-react-app project )
| backend ( your backend (express?) project )
In the your_project folder, do an npm init. Then, $ npm i concurrently so you can run your backend and the react dev server... concurrently.
Modify the package.json in your_project to have something like this:
"start": "concurrently --kill-others \"cd frontend && npm start\" \"cd backend && npm start\"",Finally, in the package.json of your frontend folder (that's the react app), add a proxy block like this:
"proxy": {
"/api": {
"target": "http://localhost:9000",
"secure": false
}
}In this example, your react app runs on whatever port (let's say 3000) and your backend is running on port 9000.
Any request to http://localhost:3000/api/* will be proxied to http://localhost:9000/api/*.