51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
"""FastAPI application entry point."""
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
from app.api.v1 import auth, settings as settings_router, query, analysis
|
|
from app.config import settings
|
|
|
|
# Create FastAPI app
|
|
app = FastAPI(
|
|
title=settings.APP_NAME,
|
|
debug=settings.DEBUG,
|
|
version="1.0.0"
|
|
)
|
|
|
|
# CORS middleware
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"], # TODO: Configure properly in production
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# API v1 routes
|
|
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")
|
|
|
|
# Serve static files (frontend)
|
|
# app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
"""Root endpoint."""
|
|
return {"message": "Brief Bench API", "version": "1.0.0"}
|
|
|
|
|
|
@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)
|