-
-
Save ishan-marikar/5ae1d874bf71117f9e02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
function geoIP(host) { | |
var ip = host.match("[0-9]+(?:\.[0-9]+){3}"); | |
var result, url = "http://ip-api.com/json/" + ip[0]; | |
request(url, function(error, response, body) { | |
return JSON.parse(body); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment