25 lines
487 B
Python
25 lines
487 B
Python
"""FastAPI application."""
|
|
|
|
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import Depends, FastAPI, HTTPException
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.api import router
|
|
from app.db import get_db, init_db
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
init_db()
|
|
yield
|
|
|
|
|
|
app = FastAPI(title="PromptCR-Lab API", lifespan=lifespan)
|
|
app.include_router(router.api_router, prefix="/api")
|
|
|
|
|
|
@app.get("/health")
|
|
def health_check():
|
|
return {"status": "ok"}
|