@ladjs/store-ip-address
v0.0.7
Published
Stores user's IP address in the background for Lad
Downloads
246
Readme
@ladjs/store-ip-address
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
andlast_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/ |