Today we’ll see how we can get our user’s city, state, and country location information using their IP address and a from a free library and database called IP2Location.
Since, when working locally in NodeJS/AdonisJS our IP address is going to be localhost (127.0.0.1), I’ve gone ahead and grabbed three different IP addresses from my VPN for us to use as examples.
Chicago, United States: 220.127.116.11
Frankfurt, Germany: 18.104.22.168
Stockholm, Sweden: 22.214.171.124
What we need to do now is get the location through some service, and then we can compare the location via the service by its accuracy for the VPN's name for the IP address listed above.