Skip to content

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

Notifications You must be signed in to change notification settings

mathiasgheno/express-browser-block

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

Stars

Watchers

Forks