Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Nodejs从Eventbrite API获取事件_Javascript_Node.js_Api_Eventbrite - Fatal编程技术网

Javascript 使用Nodejs从Eventbrite API获取事件

Javascript 使用Nodejs从Eventbrite API获取事件,javascript,node.js,api,eventbrite,Javascript,Node.js,Api,Eventbrite,因此,我找不到任何示例,npm包自述文件中使用的示例引发了一个错误 所以我用 我在app.js中需要它。我创建token变量并将我的token放在其中 我将这段代码添加到 try { var api = eventbriteAPI({ token: eventbrite_token, version : 'v3' }); } catch (error) { console.log(error.message); // the options

因此,我找不到任何示例,npm包
自述文件
中使用的示例引发了一个错误

所以我用

我在
app.js
中需要它。我创建token变量并将我的token放在其中

我将这段代码添加到

try {
    var api = eventbriteAPI({
        token: eventbrite_token,
        version : 'v3'
    });
} catch (error) {
    console.log(error.message); // the options are missing, this function throws an error.
}
因此在
README
文件中,它说下一行代码应该是这样的(用我的用户id替换
user\u id:

我得到错误
TypeError:api.owned\u事件不是函数

基本上,我试图通过节点从EventBriteAPI获取基于位置的事件列表。但我甚至无法从node查询并得到我想要的东西。有人有任何资源或可以提供帮助吗


谢谢大家!

我认为自述文件有错误,api应该在try/catch块之外声明:

var api;

try {
     api = eventbriteAPI({
        token: eventbrite_token,
        version : 'v3'
    });
} catch (error) {
    console.log(error.message);
}

api.owned_events({ user_id: 30 }, function (error, data) {
    if (error)
        console.log(error.message);
    else
        console.log(JSON.stringify(data)); // Do something with your data!
});
var api;

try {
     api = eventbriteAPI({
        token: eventbrite_token,
        version : 'v3'
    });
} catch (error) {
    console.log(error.message);
}

api.owned_events({ user_id: 30 }, function (error, data) {
    if (error)
        console.log(error.message);
    else
        console.log(JSON.stringify(data)); // Do something with your data!
});