Update README.md
If you are using Casbin.js at your frontend and Node-Casbin as your backend Casbin service, you can install this package at your backend. This package provides a wrapper for generating the user permission, which can be passed to Casbin.js at the frontend.
npm install --save @casbinjs/server-utils # or yarn add @casbinjs/server-utils
import {getUserPermission} from '@casbinjs/server-utils' // In your Restful API private async setRouter(): Promise<void> { this.app.get('/api/casbin', async (req: express.Request, res: express.Response) => { // Get the user identity from URL. const user = String(req.query["casbin_user"]); // Generate the valid permission string. You need to inialize a Casbin enforcer before calling the `getUserPermission` const permission = await getUserPermission(enforcer, user); res.status(200).json({ message: 'ok', data: permission }) }) }