def route(path, **kwargs):
    """Define a http route that should trigger the function

    The parameters to this decorator will be passed to the ``route`` function of Bottle

    :param path: path to match
    :param kwargs: additional keyword arguments to be passed to Bottle
    """

    def route_decorator(f):
        f.metadata = getattr(f, "metadata", {})
        f.metadata['plugin_actions'] = f.metadata.get('plugin_actions', {})
        f.metadata['plugin_actions']['route'] = \
            f.metadata['plugin_actions'].get('route', [])
        kwargs['path'] = path
        f.metadata['plugin_actions']['route'].append(kwargs)
        return f

    return route_decorator