Skip to content

AlexanderRossa/example-web-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Example FastAPI & React App

Implements a simple React interface for creating new products, displaying them in a table and deleting them. It uses SQLite for persistence.

Running Locally

Note: All of the commands assume root dir as the root of the repo. Adjust accordingly.

  • Open two terminals and change directory (cd) to client and server respectively.

  • In server terminal:

    • Install required packages based on the requirements.txt file. (Note: You might want to use a virtual environment to isolate your main installation.)
    pip install -r requirements.txt
    
    • Start the server backend using uvicorn. You can optionally set it to reload automatically on code changes using --reload).
    uvicorn src.main:app --reload
    
  • In client terminal:

    • Install the necessary NPM packages using:
    npm install
    
    • Start up the React application in the client terminal using:
    npm start
    
  • You can now access the React application at http://localhost:3000

  • The backend API is accessible at http://localhost:8000. For direct interaction I recommend using http://localhost:8000/docs which enables you to run requests against the API easily.

Testing

Only the FastAPI component is covered with tests at this point. To run them, simply run pytest from the server directory and it will take care of the rest.

About

Example web app with React frontend and FastAPI backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published