34 lines
972 B
Python
34 lines
972 B
Python
from contextlib import asynccontextmanager
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.database import init_db
|
|
from app.routers import auth, bets, bankroll, dashboard, alerts, achievements, lessons, reports
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
await init_db()
|
|
yield
|
|
|
|
app = FastAPI(title="MIDAS API", version="1.0.0", lifespan=lifespan)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["http://localhost:3085", "http://magneto:3085", "*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router)
|
|
app.include_router(bets.router)
|
|
app.include_router(bankroll.router)
|
|
app.include_router(dashboard.router)
|
|
app.include_router(alerts.router)
|
|
app.include_router(achievements.router)
|
|
app.include_router(lessons.router)
|
|
app.include_router(reports.router)
|
|
|
|
@app.get("/api/health")
|
|
async def health():
|
|
return {"status": "ok", "app": "MIDAS"}
|