
- 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
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
- Install dependencies:
pip install -r requirements.txt
Running the Application
Start the development server:
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 itemsPOST /items/
- Create a new itemGET /items/{item_id}
- Get a specific itemPUT /items/{item_id}
- Update a specific itemDELETE /items/{item_id}
- Delete a specific item
System
GET /
- API informationGET /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:
alembic upgrade head
Environment Variables
No environment variables are required for basic operation.
Description
Languages
Python
93.2%
Mako
6.8%