Coverage for mpcforces_extractor\api\routes\html_routes.py: 80%
15 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-06 21:34 +0100
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-06 21:34 +0100
1from fastapi import APIRouter, Request
2from fastapi.responses import HTMLResponse
3from fastapi.templating import Jinja2Templates
4from mpcforces_extractor.api.config import TEMPLATES_DIR
6templates = Jinja2Templates(directory=TEMPLATES_DIR)
7router = APIRouter()
10# Route for the main page (MPC list)
11@router.get("/mpcs", response_class=HTMLResponse)
12async def read_mpcs(request: Request):
13 """Render the mpcs.html template"""
14 return templates.TemplateResponse("mpcs.html", {"request": request})
17# Route for nodes view (HTML)
18@router.get("/nodes", response_class=HTMLResponse)
19async def read_nodes(request: Request):
20 """Render the nodes.html template"""
21 return templates.TemplateResponse("nodes.html", {"request": request})
24# Route for main view (HTML)
25@router.get("/", response_class=HTMLResponse)
26async def read_root(request: Request):
27 """Render the nodes.html template"""
28 return templates.TemplateResponse("main.html", {"request": request})