Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ladjs/store-ip-address
Stores a user's IP address in the background for Lad
https://github.com/ladjs/store-ip-address
address ip ipv4 ipv6 koa lad mongoose passport security store
Last synced: 7 days ago
JSON representation
Stores a user's IP address in the background for Lad
- Host: GitHub
- URL: https://github.com/ladjs/store-ip-address
- Owner: ladjs
- License: mit
- Created: 2017-09-09T06:13:13.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T22:50:24.000Z (11 months ago)
- Last Synced: 2024-09-21T14:12:10.198Z (about 2 months ago)
- Topics: address, ip, ipv4, ipv6, koa, lad, mongoose, passport, security, store
- Language: JavaScript
- Homepage: https://lad.js.org
- Size: 458 KB
- Stars: 3
- Watchers: 6
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [**@ladjs/store-ip-address**](https://github.com/ladjs/store-ip-address)
[![build status](https://img.shields.io/travis/ladjs/store-ip-address.svg)](https://travis-ci.org/ladjs/store-ip-address)
[![code coverage](https://img.shields.io/codecov/c/github/ladjs/store-ip-address.svg)](https://codecov.io/gh/ladjs/store-ip-address)
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)
[![license](https://img.shields.io/github/license/ladjs/store-ip-address.svg)](<>)> Stores user's IP address in the background for Lad
## Table of Contents
* [Install](#install)
* [Usage](#usage)
* [Contributors](#contributors)
* [License](#license)## Install
[npm][]:
```sh
npm install @ladjs/store-ip-address
```[yarn][]:
```sh
yarn add @ladjs/store-ip-address
```## Usage
> With standard [logger][]:
App:
```js
const StoreIPAddress = require('@ladjs/store-ip-address');// ...
const storeIPAddress = new StoreIPAddress();
app.use(storeIPAddress.middleware);
```Mongoose user model:
```js
const storeIPAddress = new StoreIPAddress();
User.plugin(storeIPAddress.plugin);
```> With custom [logger][] instance:
App:
```js
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:
```js
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:
```js
const storeIPAddress = new StoreIPAddress({
ip: 'ip_address',
lastIps: 'last_ip_addresses'
});User.plugin(storeIPAddress.plugin);
```## Contributors
| Name | Website |
| -------------- | -------------------------- |
| **Nick Baugh** | |## License
[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)
##
[npm]: https://www.npmjs.com/
[yarn]: https://yarnpkg.com/
[logger]: https://github.com/ladjs/logger