from fastapi import FastAPI, Request, Response
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
from utils import get_page_data, process_initial
import uvicorn

app = FastAPI()
templates = Jinja2Templates(directory="templates")
app.mount("/static", StaticFiles(directory="static"), name="static")


@app.get("/", response_class=HTMLResponse)
async def home(request: Request):
    # Expect requests with cookies
    return process_initial(request)


@app.get("/page", response_class=HTMLResponse)
async def home(request: Request):
    # Expect requests with cookies
    return get_page_data(request)


if __name__ == "__main__":
    uvicorn.run("main:app", host="127.0.0.1", port=8050, log_level="info")

[(8, 'fastapi.FastAPI', 'FastAPI', False, 'from fastapi import FastAPI, Request, Response\n'), (9, 'fastapi.templating.Jinja2Templates', 'Jinja2Templates', False, 'from fastapi.templating import Jinja2Templates\n'), (10, 'fastapi.staticfiles.StaticFiles', 'StaticFiles', False, 'from fastapi.staticfiles import StaticFiles\n'), (16, 'utils.process_initial', 'process_initial', False, 'from utils import get_page_data, process_initial\n'), (22, 'utils.get_page_data', 'get_page_data', False, 'from utils import get_page_data, process_initial\n'), (26, 'uvicorn.run', 'uvicorn.run', False, 'import uvicorn\n')]