Implements a simple React interface for creating new products, displaying them in a table and deleting them. It uses SQLite for persistence.
Note: All of the commands assume root dir as the root of the repo. Adjust accordingly.
-
Open two terminals and change directory (
cd) toclientandserverrespectively. -
In
serverterminal:- Install required packages based on the
requirements.txtfile. (Note: You might want to use a virtual environment to isolate your main installation.)
pip install -r requirements.txt- Start the
serverbackend usinguvicorn. You can optionally set it to reload automatically on code changes using--reload).
uvicorn src.main:app --reload - Install required packages based on the
-
In
clientterminal:- Install the necessary NPM packages using:
npm install- Start up the React application in the
clientterminal 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 usinghttp://localhost:8000/docswhich enables you to run requests against the API easily.
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.