var https = require('https');
async function getOrderBook(){
var options = {
host: 'api.bybit.com',
port: 443,
path: '/v2/public/orderBook/L2?symbol=BTCUSD',
method: 'GET'
};
https.request(options, function(res) {
res.on('data', function (chunk) {
//console.log(chunk);
return chunk;
});
}).end();
}
console.log(getOrderBook())
The following logs
Promise { undefined }
in the console. However, I can log it fine from inside the function. How to make it so it waits for the function to resolve?
returnstatement beforehttp.request(..)?