authorize-role
v0.0.0
Published
A simple role-based authorization middleware for express.
Readme
authorize-role
A simple role-based authorization middleware for Express.
Installation
npm install --save authorize-roleUsage
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.
