@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
40 lines (39 loc) • 1.17 kB
TypeScript
import { Router, Handler } from "express";
import { IRoute } from "../types";
import { PostmanRouteItem } from "../types/postman";
import Routes from "./Routes";
import Module from "./Module";
declare class Route<T = any> {
module?: Module<T>;
id: string;
method: "GET" | "POST" | "PUT" | "DELETE";
path: string;
middlewares: Handler[];
name: string;
description: string;
rai: string;
roles: string[];
postman?: {
body?: Record<string, unknown>;
params?: Array<{
key: string;
value: string;
description: string;
}>;
};
constructor(r: IRoute);
/**
* This function is used to register a module to the route
* so that we can use the module name in the route
* and also to access the module config if needed
*/
registerModule(module: Module<T>): void;
buildRoute(router: Router, route: Routes, prefix: {
path: string;
}): void;
/**
* This function is used to generate the route for postman collection (route = request)
*/
generateRoute(pathPrefix?: string): PostmanRouteItem;
}
export default Route;