Soy un principiante en Node, cuando trato de actualizar la solicitud de API (API del tiempo) en el navegador, nunca cambia, pero si trato de ejecutar en la línea de comandos, pronostica el clima en vivo.
const express = require("express"); const { all } = require("express/lib/application"); // HTTPS library requrired` const https = require("https"); const app = express(); const port = 3000; app.get("/", function(req, res){ // Getting data from external server const url = "https://api.openweathermap.org/data/2.5/weather?q=Mumbai&appid=---------------------------------&units=metric"; // Adding functions to our own server https.get(url, function(respone){ console.log(respone.statusCode); // Getting data and putting on our server respone.on("data", function(data){ // Parsing the data to an actuall javascript object var allData = JSON.parse(data) const temp = allData.main.temp; const description = allData.weather[0].description; const icon = allData.weather[0].icon; const imageUrl = "http://openweathermap.org/img/wn/"+ icon +"@2x.png" res.write("<p>The weather type here is: "+description+"</p>") res.write("<h1>The temperature here is: "+temp+"</h1>") res.write("<img src = "+imageUrl+"></img>"); res.send(); console.log(allData) }) }) }) app.listen(port, function(){ console.log("Server is running on port 3000"); })