I want to save the body from a get request in a variable (using the request module), but its undefined.
I've searched for a solution but nothing worked so far. Guess the problem is that request.get is calles async (so far i have no experience in async functions).
const request = require("request")
...
let foo;
request.get(options,function(err,response,body){
foo = body;
});
console.log(foo);
expected: the body of the valid get-request actual: undefined