authorized
authorized copied to clipboard
can you provide simple example
trafficstars
Example route /admin how to prevent a normal user or authorize but not admin to access that route? Sorry I am new to nodejs and express.
auth.role('admin', (req, done) => {
done(null, getUser(req).type === 'admin');
});
...
auth.action('administer', ['admin', 'editorz']);
...
app.get(
'/somePath',
auth.can('administer'),
(req, res, next) => {})
The project ships with a test suite which shows some examples.