A simple web application to lookup geographic information from IP addresses using the geoip-lite module for Node.js.
- Look up geographic information by IP address
- Display country, region, city, timezone, and coordinates
- Simple and clean web interface
- Fast and efficient local lookups using geoip-lite
- Clone or navigate to the project directory:
cd geoip-server- Install dependencies:
npm install- Start the server:
npm start- Open your browser and navigate to:
http://localhost:3000
- Enter an IP address in the input field (e.g.,
8.8.8.8) and click "Lookup"
The server provides a REST API endpoint:
GET /api/ip/:ip
Returns JSON data containing geographic information for the specified IP address.
Example request:
GET http://localhost:3000/api/ip/8.8.8.8
Example response:
{
"ip": "8.8.8.8",
"country": "US",
"region": "CA",
"city": "Mountain View",
"timezone": "America/Los_Angeles",
"coordinates": {
"latitude": 37.4056,
"longitude": -122.0775
},
"metro": 807,
"area": 650,
"raw": { ... }
}- Node.js - Runtime environment
- Express - Web framework
- geoip-lite - IP geolocation library
geoip-server/
├── server.js # Express server and API routes
├── public/
│ └── index.html # Frontend web interface
├── package.json # Dependencies and scripts
├── README.md # This file
└── .gitignore # Git ignore rules
ISC