Answer the question
In order to leave comments, you need to log in
Why is it not possible to get GET request data in request, an empty variable in the console?
const request = require('request');
var cards;
request({
method: 'GET',
url: 'https://reqres.in/api/users'
}, function (error, response, body) {
if (!error && response.statusCode == 200) {
cards = body;
}
})
console.log(cards);
Answer the question
In order to leave comments, you need to log in
const request = require('request');
var cards;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question