96 lines
2.1 KiB
Markdown
96 lines
2.1 KiB
Markdown
# QuickSimpleAPI
|
|
|
|
A simple FastAPI application with SQLite database integration for basic CRUD operations.
|
|
|
|
## Features
|
|
|
|
- FastAPI with SQLite backend
|
|
- CRUD operations for items
|
|
- Alembic for database migrations
|
|
- Health check endpoint
|
|
- OpenAPI documentation
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
/
|
|
├── app/
|
|
│ ├── api/
|
|
│ │ ├── deps.py
|
|
│ │ ├── health.py
|
|
│ │ └── v1/
|
|
│ │ ├── api.py
|
|
│ │ └── endpoints/
|
|
│ │ └── items.py
|
|
│ ├── core/
|
|
│ │ └── config.py
|
|
│ ├── db/
|
|
│ │ ├── base.py
|
|
│ │ └── session.py
|
|
│ ├── models/
|
|
│ │ └── item.py
|
|
│ └── schemas/
|
|
│ └── item.py
|
|
├── migrations/
|
|
│ ├── versions/
|
|
│ │ └── 001_initial_migration.py
|
|
│ ├── env.py
|
|
│ ├── README
|
|
│ └── script.py.mako
|
|
├── alembic.ini
|
|
├── main.py
|
|
└── requirements.txt
|
|
```
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository
|
|
2. Install the dependencies:
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
## Running the Application
|
|
|
|
To run the application:
|
|
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
The API will be available at http://localhost:8000.
|
|
|
|
## API Documentation
|
|
|
|
Once the application is running, you can access the API documentation at:
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /`: Root endpoint with API information
|
|
- `GET /health`: Health check endpoint
|
|
- `GET /api/v1/items/`: List all items
|
|
- `POST /api/v1/items/`: Create a new item
|
|
- `GET /api/v1/items/{item_id}`: Get a specific item
|
|
- `PUT /api/v1/items/{item_id}`: Update a specific item
|
|
- `DELETE /api/v1/items/{item_id}`: Delete a specific item
|
|
|
|
## Database Migrations
|
|
|
|
This project uses Alembic for database migrations. To run the migrations:
|
|
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
|
|
To create a new migration:
|
|
|
|
```bash
|
|
alembic revision --autogenerate -m "Description of changes"
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
No environment variables are required for basic operation. |