March 2019
Beginner to intermediate
324 pages
7h 17m
English
In Chapter 4, Frontend with React.js, we relied on a JSON file that contained some mock data to empower and run our frontend app without needing an actual working backend to be present. Now, we need to replace all of the code where we relied on the JSON sample data file and send full HTTP requests to the backend instead.
For our React app to route the requests to our backend, we first need to add a field called proxy to the package.json file of our React application. The proxy field needs to point to the backend API address. In our case, the backend component of our application listens on local port 8000:
"proxy": "http://127.0.0.1:8000/",
The package.json file will exist in the main folder ...
Read now
Unlock full access