resonate-api / app /main.py
Aj0261's picture
chore: push all backend code and supabase to local postgres migration
70d96b7
Raw History Blame Contribute Delete
1.15 kB
# backend/app/main.py
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api import routes
from app.api import profile_analytics # <--- ADD THIS IMPORT
from app.core.ml_manager import ml_manager
from contextlib import asynccontextmanager
from app.core.config import settings
from app.api import auth, crud_routes
from app.db.database import engine, Base
@asynccontextmanager
async def lifespan(app: FastAPI):
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
ml_manager.initialize(settings.DATA_DIR)
yield
app = FastAPI(title="Resonate API", lifespan=lifespan)
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000", "https://resonance-blush-five.vercel.app"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include all routers
app.include_router(routes.router, prefix=settings.API_V1_STR)
app.include_router(profile_analytics.router, prefix=settings.API_V1_STR)
app.include_router(auth.router, prefix=settings.API_V1_STR)
app.include_router(crud_routes.router, prefix=settings.API_V1_STR)