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

154
Views
i have written it as res.send(). so gettingTO a page with noCSS just the data written i wnat to change the CSSproperties of that page how to do that

I have written this code for weather app how to change the background and CSS properties of the page the data is getting posted

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

I understand from your comments now :)
If you want to change the css, you need to add a style property to your html tags.

For example:

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

You can find more information here: 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!