Automated Action 9d9801c0d0 Create FastAPI REST API service
- Add FastAPI application with CORS support
- Implement SQLite database with SQLAlchemy
- Create Item model with CRUD operations
- Setup Alembic for database migrations
- Add comprehensive API endpoints for Items
- Include health check endpoint
- Update README with documentation
2025-06-19 20:27:19 +00:00

60 lines
1.3 KiB
Markdown

# REST API Service
A REST API service built with FastAPI and SQLite.
## Features
- FastAPI web framework
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
- CRUD operations for Items
- CORS enabled for all origins
- Health check endpoint
- Interactive API documentation
## Installation
1. Install dependencies:
```bash
pip install -r requirements.txt
```
## Running the Application
Start the development server:
```bash
uvicorn main:app --reload --host 0.0.0.0 --port 8000
```
The API will be available at:
- Main API: http://localhost:8000
- Interactive docs: http://localhost:8000/docs
- OpenAPI spec: http://localhost:8000/openapi.json
- Health check: http://localhost:8000/health
## API Endpoints
### Items CRUD
- `GET /items/` - List all items
- `POST /items/` - Create a new item
- `GET /items/{item_id}` - Get a specific item
- `PUT /items/{item_id}` - Update a specific item
- `DELETE /items/{item_id}` - Delete a specific item
### System
- `GET /` - API information
- `GET /health` - Health check
## Database
The application uses SQLite database stored at `/app/storage/db/db.sqlite`.
Database migrations are managed with Alembic. To run migrations:
```bash
alembic upgrade head
```
## Environment Variables
No environment variables are required for basic operation.