File size: 1,832 Bytes
e46d575
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c12625f
 
 
 
 
 
 
 
 
 
e46d575
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

from backend.core.config import settings
from backend.routers import badges, explain, practice, test

app = FastAPI(
    title="MathMind AI API",
    description="Adaptive math tutor backend β€” Grades 6–12",
    version="1.0.0",
)

# ── CORS ───────────────────────────────────────────────────────────────────────
app.add_middleware(
    CORSMiddleware,
    allow_origins=settings.origins_list,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# ── Routers ────────────────────────────────────────────────────────────────────
app.include_router(explain.router)
app.include_router(practice.router)
app.include_router(test.router)
app.include_router(badges.router)


# ── Root ───────────────────────────────────────────────────────────────────────
@app.get("/", tags=["root"])
async def root():
    return {
        "message": "MathMind AI API is running",
        "health": "/api/health",
        "docs": "/docs",
    }


# ── Health ─────────────────────────────────────────────────────────────────────
@app.get("/api/health", tags=["health"])
async def health():
    return {"status": "ok", "service": "MathMind AI API", "version": "1.0.0"}