Skip to content

GoodVaibhs/rest-task-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Manager REST API

A small REST API for managing personal tasks, built with FastAPI and SQLAlchemy. Supports full CRUD, filtering by status, and ships with interactive API docs out of the box.

Features

  • Create, read, update, and delete tasks
  • Filter tasks by status (todo, in_progress, done)
  • SQLite persistence via SQLAlchemy (swap in Postgres/MySQL by setting DATABASE_URL)
  • Auto-generated OpenAPI docs at /docs and /redoc

Installation

git clone https://github.com/<your-username>/rest-task-api.git
cd rest-task-api
pip install -r requirements.txt

Requires Python 3.9+.

Running the API

uvicorn main:app --reload

Then visit:

Example requests

# Create a task
curl -X POST http://127.0.0.1:8000/tasks \
  -H "Content-Type: application/json" \
  -d '{"title": "Write README", "status": "in_progress"}'

# List all tasks
curl http://127.0.0.1:8000/tasks

# List only completed tasks
curl "http://127.0.0.1:8000/tasks?status=done"

# Update a task
curl -X PATCH http://127.0.0.1:8000/tasks/1 \
  -H "Content-Type: application/json" \
  -d '{"status": "done"}'

# Delete a task
curl -X DELETE http://127.0.0.1:8000/tasks/1

Project structure

main.py        FastAPI app and route handlers
models.py      SQLAlchemy model + Pydantic request/response schemas
database.py    SQLAlchemy engine/session setup
test_main.py   Test suite (pytest + FastAPI TestClient)

Running tests

pip install -r requirements.txt
pytest

Tests run against an isolated in-memory SQLite database, so they never touch tasks.db.

License

MIT

About

A REST API for managing personal tasks, built with FastAPI and SQLAlchemy. Full CRUD, status filtering, and auto-generated OpenAPI docs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages