# main.py from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.templating import Jinja2Templates app = FastAPI() templates = Jinja2Templates(directory="templates") # Create a Jinja2Templates object @app.get("/", response_class=HTMLResponse) async def read_root(request: Request): # Render index.html template return templates.TemplateResponse("index.html", {"request": request})