Skip to content

Connecting Python backend to ReactJS UI using FastAPI (python)

License

Notifications You must be signed in to change notification settings

Ethan-Barr/python-fastapi-react-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python & ReactJS using FastAPI module in Python

This project demostrates how to link a React frnotend with a FastAPI backend using Python. This application showcases basic communication between the frontened and backend for various HTTP methods.

Prerequisites

  • Node.js: Ensure that you have Node.js installed on your machine
  • Python: Install Python on your machine, preferbally version 3.9 or later.

Frontend Setup

Instalation

  1. Navigate to the react-ui directory:
cd react-ui
  1. Instll dependencies:
npm install

Running the Frontend

Start the development server:

npm start

Vist http://localhost:3000/ in your browser to view the React Application

Backend Setup:

Installation

  1. Navigate to the api direcotry:
cd api
  1. Create a virual enviorment (recomended):
pythom -m venv venv
  1. Activate the virual envioment
    • On windows:
    venv\Scripts\activate
    • On macOS/Linux:
    source venv/bin/activate
  2. Install dependencies:
pip install -r requirements.txt

Running the Backend:

Start the FastAPI server:

python running.py

Vist https://localhost:8000/ in your browser to check that is is running

Usage

The project includes examples for various HTTP methods (GET, POST, PUT, DELETE) between the React frontend and FastAPI backend. Explore the code in both frontend and backend directories to understand how the communication is established.

Contributing

If you'd like to contribute, please fork the repository and create a pull request.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

Connecting Python backend to ReactJS UI using FastAPI (python)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published