@ladjs/store-ip-address

0.0.7 • Public • Published

@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

Package Sidebar

Install

npm i @ladjs/store-ip-address

Weekly Downloads

17

Version

0.0.7

License

MIT

Unpacked Size

11.4 kB

Total Files

13

Last publish

Collaborators

  • titanism
  • shadowgate15
  • niftylettuce
  • shaunwarman
  • spence-s