Welcome aboard! We are happy you are here and wish you good net-raft!
// put code below into script.js
var http = require('http');
const request = require('request');
var srv = http.createServer(function (req, res) {
request('http://ip-api.com/json/' , function(error, res1, body) {
var mylocation = JSON.parse(body);
var text;
text = text = mylocation.query + "</br>" + mylocation.city + "</br>" + mylocation.regionName + "</br>" +
mylocation.country + "</br>" + mylocation.timezone;
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(text);
});
});
srv.listen(3000);
console.log("Listening to Port 3000");
// type in command prompt "node script.js"
// put this url http://localhost:3000/ into any browser
The most helpful NODEJS solutions