1.1.0 • Published 2 years ago

express-browser-block v1.1.0

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

Express Browser Block

Express middleware to block browsers requests that do not satisfies the conditions

Instalation

npm install express-browser-block

Usage

import express from 'express';
import { blockRequestIfBrowserIsNot } from 'express-browser-block';
const app = express();

app.use(blockRequestIfBrowserIsNot());
// see API definitions to overwirite default values

app.get('/hello', (req, res) => {
  res.send('world');
})

app.listen(3000);

API

The blockRequestIfBrowserIsNot functions accepts two parameters: conditions and html.

The conditions parameter follows the definition of the Browser dependency.

The html is what is going to be send to your user when it doesn't satisfies the conditions parameter.