Spaces:
Running
Running
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from config.settings import get_settings | |
| from routers import auth, analyze, challenges, user, support, share, admin | |
| settings = get_settings() | |
| app = FastAPI(title="CodeNexus API", version="1.0.0") | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=[ | |
| settings.frontend_url, | |
| "http://localhost:3000", | |
| "https://codenexus-ea4.pages.dev", | |
| "https://codenexus.qzz.io", | |
| ], | |
| allow_credentials=True, | |
| allow_methods=["GET", "POST", "PATCH", "PUT", "DELETE", "OPTIONS"], | |
| allow_headers=["Content-Type", "Authorization", "X-Admin-Secret"], | |
| ) | |
| app.include_router(auth.router) | |
| app.include_router(analyze.router) | |
| app.include_router(challenges.router) | |
| app.include_router(user.router) | |
| app.include_router(support.router) | |
| app.include_router(share.router) | |
| app.include_router(admin.router) | |
| def root(): | |
| return {"status": "CodeNexus API is running"} | |
| def health(): | |
| return {"status": "healthy"} | |