APP-Backend / backend /main.py
Luca448's picture
Update independent app to newest state with LFS and binary removals
ff36e71
Raw History Blame Contribute Delete
1.12 kB
from fastapi import FastAPI, UploadFile, File, Form, HTTPException
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
from typing import Optional
from api.research import router as research_router
from api.pdf_handler import router as pdf_router
from api.iserv import router as iserv_router
app = FastAPI(title="SchoolMind AI Backend", description="Backend for SchoolMind AI App")
# Add CORS middleware to allow requests from the Android app and local Vite dev server
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # For production, restrict this to specific origins if necessary
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
def read_root():
return {"status": "online", "message": "SchoolMind AI Backend is running"}
app.include_router(research_router, prefix="/api/research", tags=["research"])
app.include_router(pdf_router, prefix="/api/pdf", tags=["pdf"])
app.include_router(iserv_router, prefix="/api/iserv", tags=["iserv"])
if __name__ == "__main__":
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)