I find that I often have the need, in a web application, to lookup information about an IP address that a request comes from.
To serve this purpose I created IPAPI (GitHub), a simple server providing a single API endpoint that returns information about an IP address.
(You should try the server just because the name is a palindrome. Imagine the awe and respect you'll get when you say "I ran a Palindrome API server today.")
The server runs on Node.js and uses the GeoLite2 database from MaxMind.
You can install and run the server with:
git clone [email protected]:guyellis/ipapi.git npm install node index.js
npm install ipapi node node_modules/ipapi/index.js
The server will download and unzip the IP database if it's not found locally.
Using the server is as simple as having your client call http://<your-domain/ip/<x.x.x.x> and getting back JSON with information about the IP.
There are plenty of improvements that can made to this simple server. Pull Requests gladly accepted.