因此,我找不到任何示例,在npm包中使用的示例README
会抛出一个错误。
所以我用https://github.com/Datahero/node-eventbrite
我需要它在app.js
。我创建令牌变量并将令牌放在那里。
我把这段片段加进
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_id:
)。
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!
});
我得到了错误TypeError: api.owned_events is not a function
基本上,我试图通过节点从Eventbrite获取基于位置的事件列表。但我甚至无法从节点查询并获得我想要的东西。有没有人能提供任何资源或帮助?
谢谢!
发布于 2017-01-10 08:29:19
我认为README文件出现了错误,应该在try/catch块之外声明api:
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!
});
https://stackoverflow.com/questions/41573112
复制