0.0.0 • Published 9 years ago

authorize-role v0.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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.

0.0.0

9 years ago