Skip to content

Instantly share code, notes, and snippets.

@GeroZayas
Last active December 27, 2025 11:49
Show Gist options
  • Select an option

  • Save GeroZayas/24908e456f260320dd1ad7d47b0194af to your computer and use it in GitHub Desktop.

Select an option

Save GeroZayas/24908e456f260320dd1ad7d47b0194af to your computer and use it in GitHub Desktop.
from fastapi.templating import Jinja2Templates
templates = Jinja2Templates(directory="templates")
@app.get("/items/{id}", response_class=HTMLResponse)
async def read_item(request: Request, id: str):
return templates.TemplateResponse(
request=request, name="item.html", context={"id": id}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment