def verify_route_validity(route: str) -> None:
    """Verify if the route is valid, and throw an error if not.

    Args:
        route: The route that need to be checked

    Raises:
        ValueError: If the route is invalid.
    """
    pattern = catchall_in_route(route)
    if pattern and not route.endswith(pattern):
        msg = f"Catch-all must be the last part of the URL: {route}"
        raise ValueError(msg)
    if route == "api" or route.startswith("api/"):
        msg = (
            f"Cannot have a route prefixed with 'api/': {route} (conflicts with NextJS)"
        )
        raise ValueError(msg)
Verify if the route is valid, and throw an error if not.

    Args:
        route: The route that need to be checked

    Raises:
        ValueError: If the route is invalid.
    
reflex/route.py