Answer the question
In order to leave comments, you need to log in
Problems requesting API Vue CLI?
Here is the api.js Vue CLI code, what is wrong with it?
import rp from 'request-promise';
const requestOptions = {
method: 'GET',
uri: 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest',
qs: {
start : 1,
limit: 5,
convert: 'USD'
},
headers: {
'X-CMC_PRO_API_KEY': 'b54bcf4d-1bca-4e8e-9a24-22ff2c3d462c',
'Access-Control-Allow-Origin': '*'
},
json: true
};
rp(requestOptions).then(response => {
const result = response.data;
}).catch((err) => {
err.message;
});
Answer the question
In order to leave comments, you need to log in
What is not clear - the error message is indicated - CORS
How to deal with it - server settings
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question