determine location of ip address nodejs

const request = require('request');

function getIpLocation(ipAddress) { const url = http://ip-api.com/json/${ipAddress};

request(url, function (error, response, body) { if (!error && response.statusCode === 200) { const data = JSON.parse(body); console.log('City:', data.city); console.log('Region:', data.regionName); console.log('Country:', data.country); } }); }

const ipAddress = '8.8.8.8'; // Replace with the IP address you want to locate getIpLocation(ipAddress);