Node JS和Coinbase
我正在尝试将Coinbase与Node Js集成,但我无法执行教程页面上给出的代码。我的代码是
`var coinbase = require('coinbase');
var client = new coinbase.Client({'apiKey': mykey, 'apiSecret': mysecret});
client.getAccounts({}, function(err, accounts) {
accounts.forEach(function(acct) {
console.log('my bal: ' + acct.balance.amount + ' for ' + acct.name);
});
});`
我得到以下错误:
回答如下:accounts.forEach(account => {^ typeError:无法读取属性'forEach'为null期待您的回答!谢谢!
错误很明显:accounts
等于null。在使用err
之前,你应该检查accounts
中的内容
Node JS和Coinbase
我正在尝试将Coinbase与Node Js集成,但我无法执行教程页面上给出的代码。我的代码是
`var coinbase = require('coinbase');
var client = new coinbase.Client({'apiKey': mykey, 'apiSecret': mysecret});
client.getAccounts({}, function(err, accounts) {
accounts.forEach(function(acct) {
console.log('my bal: ' + acct.balance.amount + ' for ' + acct.name);
});
});`
我得到以下错误:
回答如下:accounts.forEach(account => {^ typeError:无法读取属性'forEach'为null期待您的回答!谢谢!
错误很明显:accounts
等于null。在使用err
之前,你应该检查accounts
中的内容