Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

163
Visualizações
API cant show picture in web app instead show the url of the picture

I am working in a small web app that uses API from weather forecast to show the weather and weather conditions in current time. Every works perfect except at the moment of include a picture on my web app. Instead of that it shows the url of the picture:"src=http://openweathermap.org/img/wn/03n@2x.png>". Why this happens and how I can make it shows the picture.

My code in javascript is the next one:

const express=require("express");
const https=require("https");

const app=express();

app.get("/", function(req, res){

  const url="https://api.openweathermap.org/data/2.5/weather?q=Taiwan&appid=16fdd9dfb819e5ad719551bc576df7f2&units=metric"

  https.get(url, function(response){
    console.log(response.statusCode);

    response.on("data", function(data){
      const weatherData=JSON.parse(data);
      const temp=weatherData.main.temp;
      const descr=weatherData.weather[0].description;
      const icon=weatherData.weather[0].icon;
      const imageURL= "http://openweathermap.org/img/wn/"+ icon +"@2x.png"
      res.write("<p>The weather is curently"+descr+"</p>");
      res.write("<h1>The Temperature in Taiwan is "+temp +" degree Celsius.</h1>");
      res.write("<img> src=" +imageURL+">");
      res.send();
    })
  })
})

app.listen(3000, function(){
  console.log("Server is running on app 3000");
})
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda