Skip to content

AllowAccess

Lightweight Express middleware for simple role checks on routes.

You create one instance with a status code and message for denied requests, then attach allow, deny, or open to individual routes.

import AllowAccess from "allowaccess";

const access = new AllowAccess(401, "You don't have access");

router.post("/blog", access.allow(["admin", "author"]), createPost);
npm npmjs.com/package/allowaccess
Source GitLab

Next