A simple CRUD API built with FastAPI that allows users to create, read, update, and delete tasks. Data is stored in memory, so it resets whenever the server restarts.
- Clone the repository:
git clone https://github.com/varishasiddiqui/CRUD_API.git
cd CRUD_API- Create and activate a virtual environment:
python -m venv venvWindows:
venv\Scripts\activate- Install dependencies:
pip install fastapi uvicorn- Run the server:
uvicorn main:app --reloadOpen:
- API: http://127.0.0.1:8000
- Swagger UI: http://127.0.0.1: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 a new task |
| PUT | /tasks/{id} |
Update a task |
| DELETE | /tasks/{id} |
Delete a task |
Request:
curl -i http://127.0.0.1:8000/tasksResponse:
HTTP/1.1 200 OK
[
{
"id": 1,
"title": "Buy groceries",
"done": false
}
]This project stores data in memory only. Any tasks created will be lost when the server is restarted.