//ex.js
const https = require('https')
const url = "" //Use the url you want to get the data from
const request = https.request(url, (response)=>{
let data = '';
response.on('data', (chunk)=>{
data += chunk.toString() //Collecting data
})
response.on('end', ()=>{
const body = JSON.parse(data)
console.log(body) //Printing the data in json format
})
})
request.on('error',(error)=>{
console.log(error) //If the mentioned url is wrong, gives you the error output
})
request.end()//Request will be closed from here
0 Comments
Please Login to Comment Here