Coverage for app/main.py: 100%

19 statements  

« 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 

5 

6# Import the router from the routers package 

7from app.routers import node, link, search 

8 

9from app.config.logging import setup_logging 

10 

11setup_logging() 

12 

13app = FastAPI() 

14 

15# Run database updates 

16run_updates() 

17 

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) 

26 

27@app.get("/") 

28async def root(): 

29 return {"success": "ok"} 

30 

31# Register the router with the app 

32app.include_router(node.router) 

33app.include_router(link.router) 

34app.include_router(search.router) 

35 

36if TARGET != "prod": 

37 from app.routers import debug 

38 app.include_router(debug.router)