Generate res.js

    Args:
        meta: tuple(url_prefix, auth_header, resources) or metadata of API
    Returns:
        res.js source code

def generate_code(meta, prefix=None, node=False, min=False):
    """
    Generate res.js

    Args:
        meta: tuple(url_prefix, auth_header, resources) or metadata of API
    Returns:
        res.js source code
    """
    if isinstance(meta, dict):
        url_prefix, auth_header, resources = parse_meta(meta)
    else:
        url_prefix, auth_header, resources = meta
    if prefix is not None:
        url_prefix = prefix
    core = render_core(url_prefix, auth_header, resources)
    if min:
        filename = 'res.web.min.js'
    else:
        filename = 'res.web.js'
    if node:
        filename = 'res.node.js'
    base = read_file(filename)
    return base.replace('"#res.core.js#"', core)