def METHOD_NAME(
    app: Litestar,
    route: HTTPRoute | WebSocketRoute | ASGIRoute,
    route_handler: RouteHandlerType,
) -> ASGIApp:
    """Construct a middleware stack that serves as the point of entry for each route.
    Args:
        app: The Litestar app instance.
        route: The route that is being added.
        route_handler: The route handler that is being wrapped.
    Returns:
        An ASGIApp that is composed of a "stack" of middlewares.
    """
    from litestar.middleware.allowed_hosts import AllowedHostsMiddleware
    from litestar.middleware.compression import CompressionMiddleware
    from litestar.middleware.csrf import CSRFMiddleware
    # we wrap the route.handle method in the ExceptionHandlerMiddleware
    asgi_handler = wrap_in_exception_handler(
        app=route.handle, exception_handlers=route_handler.resolve_exception_handlers()  # type: ignore[arg-type]
    )
    if app.csrf_config:
        asgi_handler = CSRFMiddleware(app=asgi_handler, config=app.csrf_config)
    if app.compression_config:
        asgi_handler = CompressionMiddleware(app=asgi_handler, config=app.compression_config)
    if app.allowed_hosts:
        asgi_handler = AllowedHostsMiddleware(app=asgi_handler, config=app.allowed_hosts)
    for middleware in route_handler.resolve_middleware():
        if hasattr(middleware, "__iter__"):
            handler, kwargs = cast("tuple[Any, dict[str, Any]]", middleware)
            asgi_handler = handler(app=asgi_handler, **kwargs)
        else:
            asgi_handler = middleware(app=asgi_handler)  # type: ignore
    # we wrap the entire stack again in ExceptionHandlerMiddleware
    return wrap_in_exception_handler(
        app=cast("ASGIApp", asgi_handler),
        exception_handlers=route_handler.resolve_exception_handlers(),
    )  # pyright: ignore