"""
FastAPI routing configuration.
Maps incoming HTTP requests to the FastAPIProxyRedirect class.
"""

from fastapi import FastAPI, Request

from logger import debug_log

from fast_api import FastAPIProxyRedirect

app = FastAPI()


@app.get("/{full_path:path}")
async def proxy_handler(request: Request):
    """
    Catch-all route that passes the request to the proxy logic and returns the response.
    """
    proxy = FastAPIProxyRedirect(request)
    debug_log(f"Request made")

    return proxy.get_response()
