95 lines
2.3 KiB
Markdown
95 lines
2.3 KiB
Markdown
# Simple Todo App
|
|
|
|
A simple Todo application API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete Todo items
|
|
- Automatically track creation and update timestamps
|
|
- Health check endpoint
|
|
- Database migrations with Alembic
|
|
- API documentation with Swagger UI and ReDoc
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository:
|
|
|
|
```bash
|
|
git clone <repository-url>
|
|
cd simpletodoapp-cstnbs
|
|
```
|
|
|
|
2. Install dependencies:
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Run database migrations:
|
|
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
|
|
## Running the application
|
|
|
|
Start the application with Uvicorn:
|
|
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
The API will be available at http://localhost:8000
|
|
|
|
## API Documentation
|
|
|
|
Once the application is running, you can access:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## API Endpoints
|
|
|
|
### Todo Endpoints
|
|
|
|
- `GET /todos`: Get all todo items
|
|
- `POST /todos`: Create a new todo item
|
|
- `GET /todos/{todo_id}`: Get a specific todo item
|
|
- `PUT /todos/{todo_id}`: Update a specific todo item
|
|
- `DELETE /todos/{todo_id}`: Delete a specific todo item
|
|
|
|
### Health Check
|
|
|
|
- `GET /health`: Check the health status of the application
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
simpletodoapp-cstnbs/
|
|
├── app/
|
|
│ ├── api/
|
|
│ │ └── routes.py # API route definitions
|
|
│ ├── core/
|
|
│ │ └── config.py # Application configuration
|
|
│ ├── db/
|
|
│ │ └── database.py # Database connection setup
|
|
│ ├── models/
|
|
│ │ └── todo.py # SQLAlchemy models
|
|
│ ├── schemas/
|
|
│ │ └── todo.py # Pydantic schemas for API
|
|
│ └── storage/
|
|
│ └── db/ # SQLite database storage
|
|
├── migrations/ # Alembic migrations
|
|
│ ├── versions/
|
|
│ │ └── *.py # Migration scripts
|
|
│ ├── env.py # Alembic environment
|
|
│ └── script.py.mako # Migration script template
|
|
├── alembic.ini # Alembic configuration
|
|
├── main.py # Application entry point
|
|
├── requirements.txt # Project dependencies
|
|
└── README.md # This file
|
|
```
|
|
|
|
## Contributing
|
|
|
|
Contributions are welcome! Please feel free to submit a Pull Request. |