mirror of
https://github.com/escalante29/healthy-fit.git
synced 2026-03-21 15:28:46 +01:00
All checks were successful
Deploy to VPS / deploy (push) Successful in 26s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
964 B
Python
39 lines
964 B
Python
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.api.v1.api import api_router
|
|
from app.config import settings
|
|
from app.core.ai_config import configure_dspy
|
|
from app.db import init_db
|
|
from app.models import push_subscription # noqa: F401 — ensures table is created
|
|
from app.scheduler import start_scheduler, stop_scheduler
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
init_db()
|
|
configure_dspy()
|
|
start_scheduler()
|
|
yield
|
|
stop_scheduler()
|
|
|
|
|
|
app = FastAPI(title="Healthy Fit API", lifespan=lifespan)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=[o.strip() for o in settings.CORS_ORIGINS.split(",")],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(api_router, prefix="/api/v1")
|
|
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {"message": "Welcome to Healthy Fit API", "version": "1.0.0"}
|