UNPKG

@the-teacher/the-router

Version:

Simple router for Express.js, making routes and actions easy to manage.

25 lines 1.34 kB
import { Router, RequestHandler, RouterOptions } from "express"; import { RouteInfo } from "./router-state"; /** * Sets options for Express Router * @param options - Router configuration options */ export declare const setRouterOptions: (options: RouterOptions) => void; /** * Returns current router instance or creates a new one if it doesn't exist * @returns Express Router instance */ export declare const getRouter: () => Router; export declare const resetRouter: () => void; export declare const setActionsPath: (path: string) => string; export declare const isCustomActionsPath: () => boolean; export declare const getActionsPath: () => string; export declare const setRouterScope: (scope: string | null) => void; export declare const getRouterScope: () => string | null; export declare const getScopeMiddlewares: () => RequestHandler[]; export declare const setScopeMiddlewares: (middlewares: RequestHandler[]) => void; export declare const routeScope: (scope: string, middlewaresOrCallback: RequestHandler[] | (() => void), routesDefinitionCallback?: () => void) => void; export declare const addRouteToMap: (method: string, path: string | RegExp, action: string, middlewares?: RequestHandler[]) => void; export declare const getRoutesMap: () => Map<string, RouteInfo>; export type { RouteInfo }; //# sourceMappingURL=base.d.ts.map