Skip to content

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

About

Stores a user's IP address in the background for Lad

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •