Checkout the project
git clone https://github.com/Senofjohan/starter_react_and_fastapi.git
Software versions used for project setup.
josh at starter_react_and_fastapi 🌲 node --version v14.15.0 josh at starter_react_and_fastapi 🌲 python3 --version Python 3.8.4 josh at starter_react_and_fastapi 🌲 pip3 --version pip 20.1.1 josh at starter_react_and_fastapi 🌲 npm --version 6.14.8
Frontend
# Install the software dependencies `from npm
npm install
# npm run start which starts the server
npm run start
# open localhost: 3000
Backend
cd backend
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
pip list
cd src
uvicorn api:app --reload
Activate the virtual environment so we can install software dependencies into it separate from what is on the system- https://docs.python.org/3.8/library/venv.html
source env/bin/activate
Install the dependencies from requirements.txt into virtual environment so all team members have same dependencies.
pip install -r requirements.txt cd backend/src uvicorn api:app --reload
Run the app using uvicorn server in reload mode. Changing files in src, will cause the server to automatically load your changes.
source env/bin/activate pip install newsapi-python
pip freeze > requirements.txt
cd backend/src
Run the app using uvicorn server in reload mode. Changing files in src, will cause the server to automatically load your changes.
uvicorn api:app —-reload
If you need to run with the python debugger use - https://fastapi.tiangolo.com/tutorial/debugging/#run-your-code-with-your-debugger
Frontend with react - https://reactjs.org/docs/getting-started.html Backend with FastApi - https://fastapi.tiangolo.com/
This project has cors(Cross origin resource sharing) configured using the fastapi documentation so that requests can be received from the frontend - https://fastapi.tiangolo.com/tutorial/cors/?h=+cors