
- Set up FastAPI application with CORS support - Created SQLAlchemy models for task management - Implemented CRUD operations for tasks - Added database migrations with Alembic - Created REST API endpoints for task operations - Added health check endpoint - Updated README with comprehensive documentation - Applied code formatting with Ruff
1.5 KiB
1.5 KiB
Task Manager API
A simple task management API built with FastAPI and SQLite.
Features
- Create, read, update, and delete tasks
- Task status tracking (completed/pending)
- Task priority levels (high, medium, low)
- Automatic timestamps (created_at, updated_at)
- Health check endpoint
- Interactive API documentation
Installation
- Install dependencies:
pip install -r requirements.txt
- Run database migrations:
alembic upgrade head
- Start the application:
uvicorn main:app --reload
The API will be available at http://localhost:8000
API Endpoints
Root
GET /
- Get API information and links
Health Check
GET /health
- Check API health status
Tasks
GET /tasks/
- List all tasksPOST /tasks/
- Create a new taskGET /tasks/{task_id}
- Get a specific taskPUT /tasks/{task_id}
- Update a taskDELETE /tasks/{task_id}
- Delete a task
Documentation
- Interactive API documentation:
http://localhost:8000/docs
- Alternative documentation:
http://localhost:8000/redoc
- OpenAPI schema:
http://localhost:8000/openapi.json
Task Schema
{
"title": "string",
"description": "string (optional)",
"completed": "boolean (default: false)",
"priority": "string (default: 'medium')"
}
Development
This project uses:
- FastAPI - Web framework
- SQLAlchemy - ORM
- Alembic - Database migrations
- SQLite - Database
- Ruff - Code formatting and linting