16 lines
442 B
Python
16 lines
442 B
Python
|
from pathlib import Path
|
||
|
|
||
|
from fastapi import FastAPI
|
||
|
from fastapi.responses import HTMLResponse
|
||
|
from fastapi.staticfiles import StaticFiles
|
||
|
|
||
|
ROOT = Path(__file__).parent
|
||
|
app = FastAPI()
|
||
|
app.mount('/static', StaticFiles(directory='static'), name='static')
|
||
|
|
||
|
|
||
|
@app.get('/', response_class=HTMLResponse)
|
||
|
async def index():
|
||
|
content = (ROOT / 'templates' / 'index.html').open().read()
|
||
|
return HTMLResponse(content=content, status_code=200)
|