GeoIp-lite returning null

93 views Asked by At

I have my replit project to get country by ip but lookup(ip) dont work Logs My code is

app.get('/ip/locstion/get/', (req, res) => {

  const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;

  const loc = lookup(ip);

 console.log(loc)

  console.log(ip)

  res.send("IP:" + ip+ "Location:\nCountry: "+loc.country + "Region: "+loc.region)

})


  


  
0

There are 0 answers