@ladjs/store-ip-address

Stores user's IP address in the background for Lad

Stats

StarsIssuesVersionUpdatedCreatedSize
@ladjs/store-ip-address
300.0.72 years ago4 years agoMinified + gzip package size for @ladjs/store-ip-address in KB

Readme

@ladjs/store-ip-address

build status code coverage code style styled with prettier made with lass license

Stores user's IP address in the background for Lad

Table of Contents

Install

npm:

npm install @ladjs/store-ip-address

yarn:

yarn add @ladjs/store-ip-address

Usage

With standard logger:

App:

const StoreIPAddress = require('@ladjs/store-ip-address');

// ...

const storeIPAddress = new StoreIPAddress();
app.use(storeIPAddress.middleware);

Mongoose user model:

const storeIPAddress = new StoreIPAddress();
User.plugin(storeIPAddress.plugin);

With custom logger instance:

App:

const StoreIPAddress = require('@ladjs/store-ip-address');
const Logger = require('@ladjs/logger');

// ...

const storeIPAddress = new StoreIPAddress({ logger: new Logger() });
app.use(storeIPAddress.middleware);

With custom fields to store on user model instead of ip and last_ips:

App:

const StoreIPAddress = require('@ladjs/store-ip-address');
const Logger = require('@ladjs/logger');

// ...

const storeIPAddress = new StoreIPAddress({
  ip: 'ip_address',
  lastIps: 'last_ip_addresses'
});

app.use(storeIPAddress.middleware);

Mongoose user model:

const storeIPAddress = new StoreIPAddress({
  ip: 'ip_address',
  lastIps: 'last_ip_addresses'
});

User.plugin(storeIPAddress.plugin);

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.