@vortex-js/core
Version:
A simple and powerful role-based access control (RBAC) middleware for Express.js, designed to be easy to use and integrate with your existing applications. It provides a flexible way to manage user permissions and roles, making it ideal for building secur
17 lines (16 loc) • 530 B
JavaScript
import { extractRoutesAndroles } from "./utils";
export function InitializeCreatingRAIs(RoutesInstance) {
try {
// Step 1: Extract all routes and parents in a single pass
const { routes, roles } = extractRoutesAndroles(RoutesInstance.routes, RoutesInstance.prefix);
// Step 2: Return the extracted routes and roles
return {
rais: routes,
roles,
};
}
catch (error) {
console.error("Error during rai seeding:", error);
throw error;
}
}