brief-rags-bench/app/main.py

54 lines
1.3 KiB
Python
Raw Permalink Normal View History

2025-12-17 15:37:32 +01:00
"""FastAPI application entry point."""
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
2025-12-17 16:29:53 +01:00
from fastapi.responses import FileResponse
2025-12-17 15:37:32 +01:00
from app.api.v1 import auth, settings as settings_router, query, analysis
from app.config import settings
app = FastAPI(
title=settings.APP_NAME,
debug=settings.DEBUG,
version="1.0.0"
)
app.add_middleware(
CORSMiddleware,
2025-12-18 09:36:24 +01:00
allow_origins=["*"],
2025-12-17 15:37:32 +01:00
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(auth.router, prefix="/api/v1")
app.include_router(settings_router.router, prefix="/api/v1")
app.include_router(query.router, prefix="/api/v1")
app.include_router(analysis.router, prefix="/api/v1")
2025-12-17 16:29:53 +01:00
app.mount("/static", StaticFiles(directory="static"), name="static")
@app.get("/app")
async def serve_frontend():
"""Serve the main frontend application."""
return FileResponse("static/index.html")
2025-12-17 15:37:32 +01:00
@app.get("/")
async def root():
2025-12-17 16:29:53 +01:00
"""Root endpoint - redirect to app."""
return FileResponse("static/index.html")
2025-12-17 15:37:32 +01:00
@app.get("/health")
async def health():
"""Health check endpoint."""
return {"status": "ok"}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)