Skip to content

Instantly share code, notes, and snippets.

@SrJSDev
Created January 27, 2024 21:59
Show Gist options
  • Save SrJSDev/c55bc003a7dfec1ba036cd8990f39692 to your computer and use it in GitHub Desktop.
Save SrJSDev/c55bc003a7dfec1ba036cd8990f39692 to your computer and use it in GitHub Desktop.
Simple & Free IP info API
const geoIP = (ip) => await fetch(`https://ipinfo.io/${ip}/geo`).then(r => r.json())
/*
{
"ip": "70.75.208.132",
"hostname": "s0106889e6845ba54.lb.shawcable.net",
"city": "Lethbridge",
"region": "Alberta",
"country": "CA",
"loc": "49.7000,-112.8186",
"org": "AS6327 Shaw Communications Inc.",
"postal": "T1H",
"timezone": "America/Edmonton",
"readme": "https://ipinfo.io/missingauth"
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment