For Django
A simple example of using RestAPi on FastAPI
git clone https://github.com/ZeroNiki/FastAPI-RestAPI-Example.git
cd FastAPI-RestAPI-Example
python3 -m venv venv
source venv/bin/activate
pip insatll -r requirements.txt
alembic revision --autogenerate -m "INIT"
alembic upgrade head
uvicorn start:app --reload
go 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/add
Update 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}"