This is the code
const express = require("express");
const app = express();
const https = require("http");
app.get("/", function(req, res) {
const url ="http://api.openweathermap.org/geo/1.0/directq=London&unit=metric&appid=";
https.get(url, function(response){
console.log(response.statusCode);
response.on("data", function(data) {
let weatherData = [];
weatherData.push(data);
const parse = JSON.parse(weatherData);
console.log(parse);
});
});
res.send("Server has started");
});
app.listen(3000, function() {
console.log("Server running in port 3000");
});
When I try to console.log(data) in response.on() it gives me the hexadecimal value of of the url or api(hidden). I am trying to make a JS object of the data which is being the input of the callback function.