authorize-role

0.0.0 • Public • Published

authorize-role

A simple role-based authorization middleware for Express.

Installation

npm install --save authorize-role

Usage

Import it with:

var authorize = require('authorize-role');

The request object must have a user property with a role for this to work.

To authorize a certain role, e.g. 'admin', you can do:

var app = express();
app.use(authorize('admin'));

This will make all requests fail with 404 if they do not have a user.role equal to 'admin'.

Licence

Licensed under MIT.

Readme

Keywords

Package Sidebar

Install

npm i authorize-role

Weekly Downloads

1

Version

0.0.0

License

MIT

Last publish

Collaborators

  • bsonntag