the api is implemented using python fastapi framework, uvicorn server and mongodb database.
1.) Install all the packages mentioned in pipfile 2.) open the terminal cd to this project directory and run "uvicorn main:app --reload" to start the api. 3.) use the login route first before testing any api routes for authorization purpose. 4.) the test database collections used in testing this project is given as json files in this repository. 5.) use "mongodb compass" application to import the json files into your database collection easily.
login route: http://127.0.0.1:8000/login/rohith/drabby - (http post request)
- username and password is sent as path parameters
update cart route: http://127.0.0.1:8000/updateCart/60e80e25061fcc32a8b9393b?item=61288bcfcde89d37d11db4e5 - (http put request)
- userid is sent as path parameter and item id is sent as query parameter
remove item route: http://127.0.0.1:8000/removeItem/6128ad862aa8de37767fdafe - (http delete request)
- item id is sent as path parameter
get items route: http://127.0.0.1:8000/getItems - (http get request)
- no headers, path and query parameters are required
update item request: http://127.0.0.1:8000/updateItem/61288bcfcde89d37d11db4e5?price=52 - (http put request)
- item id is sent as path parameter
add item route: http://127.0.0.1:8000/addItem - (http get request)
- json object is sent in request body