I'm new to nodejs. I’m not seeing the response in ex 1, but i see in ex 2. Why? Await works for me in other places, using babel.
Ex 1
let res = await request(url)
console.log(res);
console.log(res.body);
Ex 2
request(url, function (error, res, body) {
if (!error && response.statusCode == 200) {
console.log(body)
}
});
Await works in other places, I’m using babel and required modules for es6 and es7 features. For example, await works in squelize call, i validated. But it doesn’t work for request call. Why?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…