54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
"""FastAPI application entry point."""
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from fastapi.staticfiles import StaticFiles
|
|
from fastapi.responses import FileResponse
|
|
|
|
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,
|
|
allow_origins=["*"],
|
|
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")
|
|
|
|
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")
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
"""Root endpoint - redirect to app."""
|
|
return FileResponse("static/index.html")
|
|
|
|
|
|
@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)
|