Create virtal environment : python3 -m venv envi
Activate it: envi\Scripts\activate
We can also use pip install -r requirments.txt but I am having saome problem in my local Machine so just plz copy paste the following cmd line.
In Virtual environment install required packages using cmd:pip install fastapi uvicorn pymongo pydantic bcrypt
Pull all files from the repository.
In database.py change username, password and URI of you mongodb atlas.
Start the application: uvicorn main:app --reload
For better experience use Postman
-
Post request- http://127.0.0.1:8000/register JSON -{ "username": "john_doe", "email": "[email protected]", "password": "securepassword" }
-
POST request - http://127.0.0.1:8000/login JSON-{ "email": "[email protected]", "password": "securepassword" }
-
POST request -http://127.0.0.1:8000/link_id JSON- { "email":"[email protected]", "password":"securepassword", "linked_id":"12345" }
-
POST request -http://127.0.0.1:8000/update_user_details/12345 JSON-{ "linked_id":"12345", "full_name": "Mohith", "age": 45, "address": "Hyderabad" }
-
GET request-http://127.0.0.1:8000/user_with_details/[email protected]
-
Delete request -http://127.0.0.1:8000/delete_user/ [email protected]