Hi everyone;
i am struggling with the syntax for taking a standard node.js API from the internet and putting it into wix-fetch. I’ve read all the articles and looked at examples and youtube but can’t seem to quite get the syntax right for doing this when a key is involved (all the good examples I find don’t have keys). Here is the code from the node.js with a sample key:
const rp = require(‘request-promise’);
const requestOptions = {
method: ‘GET’,
uri: ‘https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest’,
qs: {
‘id’: ‘1’
},
headers: {
‘X-CMC_PRO_API_KEY’: ‘b54bcf4d-1bca-4e8e-9a24-22ff2c3d462c’
},
json: true,
gzip: true
};
rp(requestOptions).then(response => {
console.log(‘API call response:’, response);
}).catch((err) => {
console.log(‘API call error:’, err.message);
});
So basically I need help changing this to the wix-fetch syntax. Thank you all in advance!