
- User authentication with JWT tokens (register/login) - Tutor session management with CRUD operations - Message tracking for tutor conversations - SQLite database with Alembic migrations - CORS configuration for frontend integration - Health check and service info endpoints - Proper project structure with models, schemas, and API routes
39 lines
939 B
Python
39 lines
939 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.api import auth, tutor
|
|
from app.db.session import engine
|
|
from app.db.base import Base
|
|
|
|
Base.metadata.create_all(bind=engine)
|
|
|
|
app = FastAPI(
|
|
title="AI Tutor Backend Service",
|
|
description="Backend API for AI-powered tutoring application",
|
|
version="1.0.0",
|
|
openapi_url="/openapi.json"
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router, prefix="/auth", tags=["authentication"])
|
|
app.include_router(tutor.router, prefix="/tutor", tags=["tutor"])
|
|
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {
|
|
"title": "AI Tutor Backend Service",
|
|
"documentation": "/docs",
|
|
"health": "/health"
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
def health_check():
|
|
return {"status": "healthy", "service": "AI Tutor Backend"} |