1.0.2 • Published 2 years ago

ip-guardian v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Ip whitelist for you express application.

Installation

npm i ip-guardian

Usages

Global usage, it works on each route:

const express = require('express');
const app = express();
const IpGuardian = require('ip-guardian');

const PORT = 3000;

/* setting whitelist */
IpGuardian.setWhitelist(['127.0.0.1']);

/* setting the middleware (checker) */
app.use(IpGuardian.checker);

app.get('/', (req, res) => {
    res.send('Helo World!');
});

app.listen(PORT);

Adding ip-guardian to specific routes

const express = require('express');
const app = express();
const IpGuardian = require('ip-guardian');

const PORT = 3000;

/* setting whitelist */
IpGuardian.setWhitelist(['127.0.0.1']);

app.get('/', IpGuardian.checker, (req, res) => {
    res.send('Helo World!');
});

app.listen(PORT);
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago