
- Create FastAPI application with CORS support - Implement Task model with SQLAlchemy - Set up database session and migrations with Alembic - Add CRUD endpoints for task management - Include health check and API documentation endpoints - Configure Ruff for code formatting and linting
1.1 KiB
1.1 KiB
Task Manager API
A barebones task manager API built with FastAPI and SQLite.
Features
- Create, read, update, and delete tasks
- SQLite database with Alembic migrations
- RESTful API endpoints
- Health check endpoint
- CORS support
- OpenAPI documentation
Requirements
- Python 3.8+
- FastAPI
- SQLite
Installation
- Install dependencies:
pip install -r requirements.txt
- Run the application:
uvicorn main:app --reload
The API will be available at http://localhost:8000
API Endpoints
GET /
- API informationGET /health
- Health checkGET /api/v1/tasks/
- List all tasksPOST /api/v1/tasks/
- Create a new taskGET /api/v1/tasks/{task_id}
- Get a specific taskPUT /api/v1/tasks/{task_id}
- Update a taskDELETE /api/v1/tasks/{task_id}
- Delete a task
Documentation
- OpenAPI spec:
http://localhost:8000/openapi.json
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
Database
The application uses SQLite with the database file stored at /app/storage/db/db.sqlite
.