Dear friends, how can I take the result of the code below and insert it into an HTML tag? Any way to do it using handlebars?

Asked

Viewed 23 times

1

var http = require("https");

var options = {
  "method": "GET",
  "hostname": "freegeoip.app",
  "port": null,
  "path": "/json/",
  "headers": {
    "accept": "application/json",
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.