For Django
A simple example of using RestAPi on FastAPI
git clone https://github.com/ZeroNiki/FastAPI-RestAPI-Example.git
cd FastAPI-RestAPI-Examplepython3 -m venv venv
source venv/bin/activate
pip insatll -r requirements.txtalembic revision --autogenerate -m "INIT"
alembic upgrade headuvicorn start:app --reloadgo to http://localhost:8000/docs
Enjoy!
get all:
curl --request GET --url "localhost:8000/operations/data"get todo:
curl --request GET --url "localhost:8000/operations/task/{id}"add todo:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"title": "title test"}' \
http://127.0.0.1:8000/operations/addUpdate todo:
curl --header "Content-Type: application/json" \
--request PUT \
--data '{"title": "Update title test"}' \
http://127.0.0.1:8000/operations/update/{id}Delete todo:
curl --request DELETE "localhost:8000/operations/delete/{id}"