
- Setup project structure and dependencies - Create Todo model and SQLAlchemy database connection - Set up Alembic for database migrations - Implement CRUD operations and API endpoints - Add health check endpoint - Update README with project documentation generated with BackendIM... (backend.im)
58 lines
1.4 KiB
Markdown
58 lines
1.4 KiB
Markdown
# Todo API
|
|
|
|
A simple Todo API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete todos
|
|
- Health check endpoint
|
|
- SQLite database with SQLAlchemy ORM
|
|
- Database migrations with Alembic
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
todoapi/
|
|
├── alembic/ # Database migrations
|
|
│ └── versions/ # Migration versions
|
|
├── app/ # Application code
|
|
│ ├── crud/ # Database CRUD operations
|
|
│ ├── models/ # SQLAlchemy models
|
|
│ ├── routes/ # API routes
|
|
│ └── schemas/ # Pydantic schemas
|
|
├── main.py # FastAPI application entry point
|
|
├── requirements.txt # Python dependencies
|
|
└── alembic.ini # Alembic configuration
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
### Todos
|
|
|
|
- `GET /api/todos`: Get all todos
|
|
- `POST /api/todos`: Create a new todo
|
|
- `GET /api/todos/{todo_id}`: Get a specific todo
|
|
- `PUT /api/todos/{todo_id}`: Update a todo
|
|
- `DELETE /api/todos/{todo_id}`: Delete a todo
|
|
|
|
### Health Check
|
|
|
|
- `GET /health`: Check API health
|
|
|
|
## Setup and Installation
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies:
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
3. Run the application:
|
|
```
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
## Documentation
|
|
|
|
API documentation is available at:
|
|
- Swagger UI: `/docs`
|
|
- ReDoc: `/redoc` |