@the-teacher/the-router
Version:
Simple router for Express.js, making routes and actions easy to manage.
20 lines • 1.83 kB
TypeScript
import { RequestHandler } from "express";
import { getRouter, getActionsPath, setActionsPath, resetRouter, routeScope, setRouterOptions } from "./base";
import { buildRoutesSchema } from "./helpers/buildRoutesSchema";
export declare const root: (middlewares: RequestHandler[] | string, actionPath?: string) => void;
export declare const get: (urlPath: string | RegExp, middlewares: RequestHandler[] | string, actionPath?: string) => void;
export declare const post: (urlPath: string | RegExp, middlewares: RequestHandler[] | string, actionPath?: string) => void;
export declare const put: (urlPath: string | RegExp, middlewares: RequestHandler[] | string, actionPath?: string) => void;
export declare const patch: (urlPath: string | RegExp, middlewares: RequestHandler[] | string, actionPath?: string) => void;
export declare const destroy: (urlPath: string | RegExp, middlewares: RequestHandler[] | string, actionPath?: string) => void;
export declare const options: (urlPath: string | RegExp, middlewares: RequestHandler[] | string, actionPath?: string) => void;
export declare const head: (urlPath: string | RegExp, middlewares: RequestHandler[] | string, actionPath?: string) => void;
export declare const all: (urlPath: string | RegExp, middlewares: RequestHandler[] | string, actionPath?: string) => void;
type ResourceOptions = {
only?: string[];
except?: string[];
};
export declare const resources: (resourceName: string, middlewaresOrOptions?: RequestHandler[] | ResourceOptions, options?: ResourceOptions) => void;
export declare const scope: (scope: string, middlewaresOrCallback: RequestHandler[] | (() => void), routesDefinitionCallback?: () => void) => void;
export { getRouter, getActionsPath, setActionsPath, resetRouter, routeScope, setRouterOptions, buildRoutesSchema };
//# sourceMappingURL=index.d.ts.map