@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
33 lines (32 loc) • 1.06 kB
TypeScript
import { Router, Handler, RequestHandler } 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[] | RequestHandler[] | any[];
name: string;
description: string;
rai: string;
roles: string[];
postman?: IRoute["postman"];
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;