import os

import jinja2
from xpresso.responses import HTMLResponse

ENVIRONMENT = jinja2.Environment(
    loader=jinja2.FileSystemLoader(
        searchpath=os.path.join(os.path.dirname(__file__), "templates")
    )
)


async def home():
    template = ENVIRONMENT.get_template("home.html.jinja")

    content = template.render(
        title="Piccolo + ASGI",
    )

    return HTMLResponse(content)
