Automated Action 938b6d4153 Create a simple generic REST API with FastAPI and SQLite
Implemented a complete FastAPI backend with:
- Project structure with FastAPI and SQLAlchemy
- SQLite database with proper configuration
- Alembic for database migrations
- Generic Item resource with CRUD operations
- REST API endpoints with proper validation
- Health check endpoint
- Documentation and setup instructions
2025-05-17 20:57:23 +00:00

14 lines
419 B
Python

from pathlib import Path
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
DB_DIR = Path("/app") / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_DIR}/db.sqlite"
engine = create_engine(
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)