59 lines
1.5 KiB
Markdown
59 lines
1.5 KiB
Markdown
# FastAPI Todo API
|
|
|
|
This is a simple Todo API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete todos
|
|
- SQLite database with SQLAlchemy ORM
|
|
- Alembic for database migrations
|
|
- Health check endpoint
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
.
|
|
├── alembic/ # Database migration files
|
|
├── app/ # Application code
|
|
│ ├── api/ # API endpoints
|
|
│ ├── core/ # Core functionality and config
|
|
│ ├── crud/ # CRUD operations
|
|
│ ├── db/ # Database setup
|
|
│ ├── models/ # SQLAlchemy models
|
|
│ └── schemas/ # Pydantic schemas
|
|
├── alembic.ini # Alembic configuration
|
|
├── main.py # Application entry point
|
|
└── requirements.txt # Project dependencies
|
|
```
|
|
|
|
## Getting Started
|
|
|
|
1. Clone the repository
|
|
2. Install the dependencies:
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
3. Run the migrations:
|
|
```
|
|
alembic upgrade head
|
|
```
|
|
4. Start the server:
|
|
```
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
## API Documentation
|
|
|
|
Once the server is running, you can access the API documentation at:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /api/v1/todos/`: Get all todos
|
|
- `POST /api/v1/todos/`: Create a new todo
|
|
- `GET /api/v1/todos/{todo_id}`: Get a specific todo by ID
|
|
- `PUT /api/v1/todos/{todo_id}`: Update a specific todo
|
|
- `DELETE /api/v1/todos/{todo_id}`: Delete a specific todo
|
|
- `GET /health`: Health check endpoint |