express-permission
v1.0.2
Published
Permission based on roles for Express
Downloads
7
Maintainers
Readme
express-permission
Permission based on roles for Express.
Install
npm install express-permission
Usage
- Set permission in the express app:
app.set('permission', { role: 'userProperty' })
app.set('permission', { role: ['my', 'nested', 'property'] })
- Set the permission in the router:
const expressPermission = require('express-permission')
router.get('/', expressPermission(), function(req, res) {
// Do some logic here
})
router.get('/', expressPermission(['admin', 'user', 'superadmin']), function(req, res) {
// Do some logic here
})
License
MIT. Copyright (c) Alex
Acknowledgement
This package is a fork from permission