Coverage for app/main.py: 100%
19 statements
« prev ^ index » next coverage.py v7.9.2, created at 2026-02-19 12:47 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2026-02-19 12:47 +0000
1from fastapi import FastAPI
2from fastapi.middleware.cors import CORSMiddleware
3from app.config.config import TARGET, ALLOWED_ORIGINS
4from app.upgrade import run_updates
6# Import the router from the routers package
7from app.routers import node, link, search
9from app.config.logging import setup_logging
11setup_logging()
13app = FastAPI()
15# Run database updates
16run_updates()
18# Configure CORS
19app.add_middleware(
20 CORSMiddleware,
21 allow_origins=ALLOWED_ORIGINS,
22 allow_credentials=True,
23 allow_methods=["*"], # Allows all methods
24 allow_headers=["*"], # Allows all headers
25)
27@app.get("/")
28async def root():
29 return {"success": "ok"}
31# Register the router with the app
32app.include_router(node.router)
33app.include_router(link.router)
34app.include_router(search.router)
36if TARGET != "prod":
37 from app.routers import debug
38 app.include_router(debug.router)