main.py
1 """ACDC Forge Backend - FastAPI application.""" 2 3 from fastapi import FastAPI 4 from fastapi.middleware.cors import CORSMiddleware 5 6 from config import get_settings 7 from api import auth, repos, patches, cache 8 9 settings = get_settings() 10 11 app = FastAPI( 12 title=settings.app_name, 13 description="Source code management platform with on-chain voting", 14 version="0.1.0", 15 ) 16 17 # CORS middleware 18 app.add_middleware( 19 CORSMiddleware, 20 allow_origins=["*"], # Configure for production 21 allow_credentials=True, 22 allow_methods=["*"], 23 allow_headers=["*"], 24 ) 25 26 # Include routers 27 app.include_router(auth.router, prefix="/api/auth", tags=["auth"]) 28 app.include_router(repos.router, prefix="/api/repos", tags=["repos"]) 29 app.include_router(patches.router, prefix="/api/patches", tags=["patches"]) 30 app.include_router(cache.router, prefix="/api/cache", tags=["cache"]) 31 32 33 @app.get("/") 34 async def root(): 35 """Root endpoint.""" 36 return { 37 "name": settings.app_name, 38 "version": "0.1.0", 39 "status": "running", 40 } 41 42 43 @app.get("/health") 44 async def health(): 45 """Health check endpoint.""" 46 return {"status": "healthy"}