res.write prints html tags as text in express

The solution for “res.write prints html tags as text in express” can be found here. The following code will assist you in solving the problem.

const express = require(“express”);
const https = require(“https”);
const app = express();

const url =
app.get(“/”, (req, res) => {
https.get(url, response => {
response.on(“data”, data => {
const weatherData = JSON.parse(data);
const temp = weatherData.main.temp;
const { description, icon } =[0];
const imageURL = `${icon}@2x.png`;

res.set(“Content-Type”, “text/html”);
res.setHeader(“Content-Type”, “text/html”);


The weather is currently ${description}

The temperature in London is ${temp} ° Celsius.

//res.send(‘server is up!!!’);

app.listen(3000, () => {
console.log(“Server started!!!”);

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

inline scripts encapsulated in