1.1.0 • Published 4 years ago
express-browser-block v1.1.0
Express Browser Block
Express middleware to block browsers requests that do not satisfies the conditions
Instalation
npm install express-browser-blockUsage
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.