Config-driven DATABASE_URL shared by the app and Alembic's env.py (fixes v1's config drift), psycopg3 driver, auto-discovering app/models package for SQLModel.metadata, and a /health endpoint that exercises the DB dependency end-to-end. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
12 lines
276 B
Python
12 lines
276 B
Python
from fastapi import FastAPI
|
|
from sqlalchemy import text
|
|
|
|
from app.db import SessionDep
|
|
|
|
app = FastAPI(title="Vinindkøb Admin API")
|
|
|
|
|
|
@app.get("/health")
|
|
def health(session: SessionDep) -> dict:
|
|
session.exec(text("SELECT 1"))
|
|
return {"status": "ok", "database": "ok"}
|