Skip to content

bsonntag/authorize-role

Repository files navigation

authorize-role

A simple role-based authorization middleware for Express.

Build

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.

About

A simple role-based authorization middleware for express.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published