trying to perform a simple https request to a public api but i'm getting "Error: CERT_UNTRUSTED"
require('https');
var options = {
host: 'btc-e.com',
path: '/api/2/btc_usd/ticker',
port: '443',
method: 'GET',
headers: {accept:'*/*'}
};
var req = https.get(options, function(res) {
console.log(res.statusCode);
res.on('data', function(d) {
process.stdout.write(d);
});
});
req.on('error', function(e) {
console.error(e);
});
solved it! I just had to update my node installation using the following commands:
sudo npm cache clean -f sudo npm install -g n sudo n stable