title: A minimal fastapi example loading index.html
body: <p>In my project folder I have a basic <code>index.html</code> file plus static files (js, css) as well as my <code>main.py</code>:</p>
  <pre class="lang-py prettyprint-override"><code>from fastapi.staticfiles import StaticFiles
  from fastapi.templating import Jinja2Templates
  from fastapi import Request
  
  app = FastAPI()
  
  templates = Jinja2Templates(directory=&quot;/&quot;)
  app.mount(&quot;/&quot;, StaticFiles(directory=&quot;/&quot;))
  
  @app.get(&quot;/&quot;)
  def serve_home(request: Request):
      return templates.TemplateResponse(&quot;index.html&quot;, context= {&quot;request&quot;: request}) 
  </code></pre>
  <p>How can I make fastapi work here? I just want my <code>index.html</code> and static files served on localhost.
  Is it problematic not to have a <code>static</code> or <code>templates</code> folder?</p>