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, 6, 8, 15), 'fastapi.FastAPI', 'FastAPI', ({}, {}), '()', False, 'from fastapi import FastAPI, Request, Response\n'), ((9, 12, 9, 50), 'fastapi.templating.Jinja2Templates', 'Jinja2Templates', (), '', False, 'from fastapi.templating import Jinja2Templates\n'), ((10, 21, 10, 52), 'fastapi.staticfiles.StaticFiles', 'StaticFiles', (), '', False, 'from fastapi.staticfiles import StaticFiles\n'), ((16, 11, 16, 35), 'utils.process_initial', 'process_initial', ({(16, 27, 16, 34): 'request'}, {}), '(request)', False, 'from utils import get_page_data, process_initial\n'), ((22, 11, 22, 33), 'utils.get_page_data', 'get_page_data', ({(22, 25, 22, 32): 'request'}, {}), '(request)', False, 'from utils import get_page_data, process_initial\n'), ((26, 4, 26, 74), 'uvicorn.run', 'uvicorn.run', (), '', False, 'import uvicorn\n')]