Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Full-Stack Flask and React

You're reading from  Full-Stack Flask and React

Product type Book
Published in Oct 2023
Publisher Packt
ISBN-13 9781803248448
Pages 408 pages
Edition 1st Edition
Author (1):
Olatunde Adedeji Olatunde Adedeji
Profile icon Olatunde Adedeji

Table of Contents (21) Chapters

Preface 1. Part 1 – Frontend Development with React
2. Chapter 1: Getting Full Stack Ready with React and Flask 3. Chapter 2: Getting Started with React 4. Chapter 3: Managing State with React Hooks 5. Chapter 4: Fetching Data with React APIs 6. Chapter 5: JSX and Displaying Lists in React 7. Chapter 6: Working with React Router and Forms 8. Chapter 7: React Unit Testing 9. Part 2 – Backend Development with Flask
10. Chapter 8: SQL and Data Modeling 11. Chapter 9: API Development and Documentation 12. Chapter 10: Integrating the React Frontend with the Flask Backend 13. Chapter 11: Fetching and Displaying Data in a React-Flask Application 14. Chapter 12: Authentication and Authorization 15. Chapter 13: Error Handling 16. Chapter 14: Modular Architecture – Harnessing the Power of Blueprints 17. Chapter 15: Flask Unit Testing 18. Chapter 16: Containerization and Flask Application Deployment 19. Index 20. Other Books You May Enjoy

Configuring the React frontend for API consumption

In this section, you will configure the frontend React app to communicate with the backend Flask server by setting up a proxy in React to consume the API from the Flask server.

In order to configure the React proxy for API consumption, you will need to update the proxy field in the package.json file of the frontend React app. The proxy field allows you to specify a URL that will be used as the base for all API requests made from the React app.

Let’s update the package.json file:

  1. Open the package.json file in the project directory using a text editor, and then add a proxy field to the package.json file and set it to the URL of your Flask server:
    {  "name": "bizza",  "version": "0.1.0",  "proxy": "http://localhost:5000"}
  2. Next, you will need to make HTTP requests to the Flask server from the React frontend. We will use the...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}