from starlette.applications import Starlette from starlette.exceptions import HTTPException from starlette.responses import FileResponse, JSONResponse, HTMLResponse from starlette.requests import Request from starlette.routing import Route async def homepage(_): return FileResponse("static/index.html") async def healthz(_): return JSONResponse({"success": True}) async def convert(req: Request): url = req.query_params.get("url") if not url: raise HTTPException(400, "Param url is missing") print(url) return HTMLResponse("FOO") app = Starlette( debug=True, routes=[ Route("/", homepage), Route("/healthz", healthz), Route("/convert", convert), ], )