def route(name=None):
    """
    Used to register a coroutine as an endpoint when you don't have
    access to an instance of :class:`.Server`

    Parameters
    ----------
    name: str
        The endpoint name. If not provided the method name will be
        used.
    """

    def decorator(func):
        route_name = name or func.__name__
        setattr(func, "__ipc_route__", route_name)

        return func

    return decorator