This Project will be a guide to create a minimalistic API for book store management using FastAPI.
To get started with this Project, Read the following:
-
set up virtual environment using python -m venv
-
when environment is created , activate it using /Scripts/activate
-
install dependencies using command pip install -r requirements.txt
-
start coding ,since we have three files here
- database.py
- models.py
- main.py
start coding in this order
-
after finishing code you can run your program with this command uvicorn main:app --reload
-
http://127.0.0.1:8000 you will get this URL,now you can check your api
-
You can Postman/curl for testing.
-
How to Check your api ? Follow this steps mentioned below http://127.0.0.1:8000/books/ GET request for retrieving all books http://127.0.0.1:8000/books/ POST request for adding a new book http://127.0.0.1:8000/books/1 GET request for retireving book with bookid = 1 http://127.0.0.1:8000/books/1 DELETE request for deleting book with bookid = 1