Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
lo he escrito como res.send(). así que ir a una página sin CSS solo los datos escritos quiero cambiar las propiedades CSS de esa página cómo hacerlo

He escrito este código para la aplicación meteorológica sobre cómo cambiar el fondo y las propiedades CSS de la página en la que se publican los datos.

 app.post("/", (req, res) => { const query = req.body.cityName; const apiKey = "48a9ebfd3c72f0c53af5c483631e82ad"; const unit = "metric"; const url = "https://api.openweathermap.org/data/2.5/weather?q=" + query + "&appid=" + apiKey + "&units=" + unit; https.get(url, (response) => { console.log(response.statusCode); response.on("data", (d) => { const weatherData = JSON.parse(d); const weatherDescription = weatherData.weather[0].description; const temp = weatherData.main.temp; const windSpeed = weatherData.wind.speed; const pressure = weatherData.main.pressure; const icon = weatherData.weather[0].icon; const imageUrl = "http://openweathermap.org/img/wn/" + icon + "@2x.png"; res.write("<p>Temperature " + query + " is " + temp + " degrees celcius.</p>"); res.write("<p> Weather description - " + weatherDescription + "</p>"); res.write("<p>Wind speed " + windSpeed + " Km/hr </h4>"); res.write("<p>Pressure is " + pressure + " mbar </p>"); res.write("<img src=" + imageUrl + "> "); res.send(); }); }); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Entiendo por tus comentarios ahora :)
Si desea cambiar el css, debe agregar una propiedad de style a sus etiquetas html.

Por ejemplo:

 res.write("<p style='background-color:red;'>Temperature " + query + " is " + temp + " degrees celcius.</p>");

Puede encontrar más información aquí: https://www.w3schools.com/html/html_css.asp#:~:text=try%20it%20yourself.-,Inline%20CSS,-An%20inline%20CSS

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!