Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-authorize-routes

Easily authorize roles based on accesscontrol grants as express middleware.

Usage

import { setGrants, canAccess } from 'express-authorize-routes';

setGrants(YOUR_GRANTS_LIST);

then in then routes do

app.get(
 '/',
 (req, res, next) => canAccess('admin', 'user', 'read', 'any')(req, res, next),
 (req, res, next) => {
  console.log('admin can see all the users');
  ...
 },
);

And you are done!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages