57 lines
1.0 KiB
Markdown
57 lines
1.0 KiB
Markdown
# Todo Backend Service
|
|
|
|
A simple Todo API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- Todo CRUD operations
|
|
- RESTful API design
|
|
- SQLite database with SQLAlchemy ORM
|
|
- Alembic for database migrations
|
|
|
|
## Requirements
|
|
|
|
Python 3.8+
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Run database migrations:
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
|
|
## Running the Application
|
|
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
The API will be available at http://localhost:8000
|
|
|
|
Swagger documentation is available at http://localhost:8000/docs
|
|
|
|
## API Endpoints
|
|
|
|
| Method | URL | Description |
|
|
| ------ | --- | ----------- |
|
|
| GET | /api/v1/todos | Get all todos |
|
|
| GET | /api/v1/todos/{id} | Get a todo by id |
|
|
| POST | /api/v1/todos | Create a new todo |
|
|
| PUT | /api/v1/todos/{id} | Update a todo |
|
|
| DELETE | /api/v1/todos/{id} | Delete a todo |
|
|
|
|
## Example JSON Payload for Creating a Todo
|
|
|
|
```json
|
|
{
|
|
"title": "Buy groceries",
|
|
"description": "Milk, eggs, bread",
|
|
"completed": false
|
|
}
|
|
``` |