______ _ ______ _ ___ _____
| ___| | | ___ \ | | / _ \|_ _|
| |_ | |_ _| |_/ /__ _ _ __ | | __ / /_\ \ | |
| _| | | | | | // _` | '_ \| |/ / | _ | | |
| | | | |_| | |\ \ (_| | | | | < | | | |_| |_
\_| |_|\__, \_| \_\__,_|_| |_|_|\_\ \_| |_/\___/
__/ |
|___/
A simple CRUD REST API built with FastAPI for the FlyRank Backend Internship assignment.
- Create tasks
- Read all tasks
- Read a task by ID
- Update tasks
- Delete tasks
- Automatic Swagger UI documentation
- Python 3
- FastAPI
- Uvicorn
- Python 3.10+
- FastAPI
- Uvicorn
Clone the repository:
git clone https://github.com/najtms/task-api.git
cd task-apiInstall dependencies:
pip install fastapi uvicornRun the server:
uvicorn main:app --reloadThe API will be available at:
http://localhost:8000
Swagger UI:
http://localhost:8000/docs
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
API information |
| GET | /health |
Health check |
| GET | /tasks |
Get all tasks |
| GET | /tasks/{id} |
Get task by ID |
| POST | /tasks |
Create task |
| PUT | /tasks/{id} |
Update task |
| DELETE | /tasks/{id} |
Delete task |
curl -i http://localhost:8000/tasksExample response:
HTTP/1.1 200 OK
content-type: application/json
[
{
"id":1,
"title":"Task 0",
"done":true
},
{
"id":2,
"title":"Task 1",
"done":true
}
]task-api/
│── main.py
│── README.md
└── images/
└── Swagger.png
Muhamad Assaad
FlyRank Backend Internship Assignment
