|
|
@@ -1,8 +1,16 @@
|
|
|
-from fastapi import FastAPI
|
|
|
+from fastapi import FastAPI, Request
|
|
|
+from fastapi.responses import HTMLResponse
|
|
|
+from fastapi.staticfiles import StaticFiles
|
|
|
+from fastapi.templating import Jinja2Templates
|
|
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
|
|
|
-@app.get("/")
|
|
|
-async def read_root():
|
|
|
- return {"Hello": "World"}
|
|
|
+app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
|
+
|
|
|
+templates = Jinja2Templates(directory="templates")
|
|
|
+
|
|
|
+
|
|
|
+@app.get("/", response_class=HTMLResponse)
|
|
|
+async def read_root(request: Request):
|
|
|
+ return templates.TemplateResponse(request=request, name="index.html", context={})
|