Socket
Book a DemoInstallSign in
Socket

ipinfodb-middleware

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipinfodb-middleware

An Express middleware to get the client IP & time details from ipinfodb.com

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Express Middleware for ipinfodb.com

Install

npm install ipinfodb-middleware

Usage

var express = require('express');
var app = express();
var key = 'abcd'; // your ipinfodb.com API key
var ipinfodb = require('ipinfodb-middleware');

app.enable('trust proxy');

app.use(ipinfodb({key: key}));

app.get('/', function (req, res) {
  // IP info is now available in req.ipinfo
  res.json(req.ipinfo);
});


app.listen(3000);

The req.ipinfo will contain the following output if things worked fine.

{
  "statusCode": "OK",
  "statusMessage": "",
  "ipAddress": "122.161.60.x",
  "countryCode": "IN",
  "countryName": "India",
  "regionName": "Delhi",
  "cityName": "Delhi",
  "zipCode": "110008",
  "latitude": "28.6667",
  "longitude": "77.2167",
  "timeZone": "+05:30"
}
Author

Jenil Gogari

Keywords

ipinfodb

FAQs

Package last updated on 15 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.