Coverage for mpcforces_extractor\api\main.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-06 21:34 +0100

1from fastapi import FastAPI 

2from fastapi.staticfiles import StaticFiles 

3from fastapi.templating import Jinja2Templates 

4from mpcforces_extractor.api.routes import ( 

5 database, 

6 extractor, 

7 file_upload, 

8 html_routes, 

9 mpcs, 

10 nodes, 

11 subcases, 

12) 

13from mpcforces_extractor.api.config import STATIC_DIR, TEMPLATES_DIR 

14 

15 

16# Setup Jinja2 templates 

17templates = Jinja2Templates(directory=TEMPLATES_DIR) 

18app = FastAPI(redirect_slashes=False) 

19 

20# Mount the static files directory 

21app.mount( 

22 "/static", 

23 StaticFiles(directory=STATIC_DIR), 

24 name="static", 

25) 

26 

27# Include routers with prefixes 

28app.include_router(mpcs.router, prefix="/api/v1/mpcs", tags=["mpcs"]) 

29app.include_router(nodes.router, prefix="/api/v1/nodes", tags=["nodes"]) 

30app.include_router(subcases.router, prefix="/api/v1/subcases", tags=["subcases"]) 

31app.include_router(file_upload.router, prefix="/api/v1", tags=["file_upload"]) 

32app.include_router(extractor.router, prefix="/api/v1", tags=["extractor"]) 

33app.include_router(database.router, prefix="/api/v1", tags=["database"]) 

34app.include_router(html_routes.router, tags=["html_routes"])