Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Query GeoIP Lookup of an IP Address using simple-geoip
// Include the package.
const simpleGeoIP = require('simple-geoip');
// Create a new instance of the package using your API key.
let geoIP = new simpleGeoIP('YOUR_API_KEY');
// Send a request for GeoIP lookup.
geoIP.lookup('', (err, data) => {
if (err) throw err; // Look for errors (if any).
console.log(data); // Dump the results to the log.
// Sample response that you will get from the API.
"ip": "",
"location": {
"country": "US",
"region": "California",
"city": "Mountain View",
"lat": 37.40599,
"lng": -122.078514,
"postalCode": "94043",
"timezone": "-08:00"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.