22 lines
743 B
Python
22 lines
743 B
Python
|
from fastapi import APIRouter, HTTPException, Request
|
||
|
from fastapi.responses import HTMLResponse
|
||
|
from jinja2 import TemplateNotFound
|
||
|
from webcomponents.timeline_white.web import render as render_timeline
|
||
|
|
||
|
router_timeline = APIRouter()
|
||
|
|
||
|
|
||
|
@router_timeline.get('/timeline/{id:int}', response_class=HTMLResponse)
|
||
|
async def timeline_example(request: Request, id: int):
|
||
|
# deps = request.app.deps
|
||
|
try:
|
||
|
return render_timeline()
|
||
|
except TemplateNotFound:
|
||
|
raise HTTPException(
|
||
|
status_code=404, detail=f'Template not found: {template_path}'
|
||
|
) from None
|
||
|
except Exception as e:
|
||
|
raise HTTPException(
|
||
|
status_code=500, detail=f'An unexpected error occurred: {str(e)}'
|
||
|
) from None
|