How to use the express-ipfilter.IpDeniedError function in express-ipfilter

To help you get started, we’ve selected a few express-ipfilter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github casz / express-ipfilter / example / app.js View on Github external
'use strict'

const express = require('express')
const path = require('path')
const logger = require('morgan')
const cookieParser = require('cookie-parser')
const bodyParser = require('body-parser')
const favicon = require('serve-favicon')

const routes = require('./routes/index')
const users = require('./routes/users')
const ipfilter = require('express-ipfilter').IpFilter
const IpDeniedError = require('express-ipfilter').IpDeniedError

const app = express()

// view engine setup
app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'pug')

// uncomment after placing your favicon in /public
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')))
app.use(logger('dev'))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(cookieParser())
app.use(express.static(path.join(__dirname, 'public')))

const ips = ['::ffff:127.0.0.1']

express-ipfilter

A light-weight IP address based filtering system

MIT
Latest version published 9 months ago

Package Health Score

60 / 100
Full package analysis