import os

import jinja2

from sanic import HTTPResponse

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


def index():
    template = ENVIRONMENT.get_template("home.html.jinja")
    content = template.render(title="Piccolo + ASGI")
    return HTTPResponse(content)