frexp
Version:
70 lines (61 loc) • 1.87 kB
TypeScript
declare module "frexp/lib/Decorator" {
/**
* Define the prefix for the controller.
* @param prefix - The prefix for all routes in this controller.
*/
export function Controller(prefix: string): ClassDecorator;
/**
* Define a POST method route.
* @param path - The route path.
*/
export function Post(path: string): MethodDecorator;
/**
* Define a GET method route.
* @param path - The route path.
*/
export function Get(path: string): MethodDecorator;
/**
* Define a DELETE method route.
* @param path - The route path.
*/
export function Delete(path: string): MethodDecorator;
/**
* Define a PATCH method route.
* @param path - The route path.
*/
export function Patch(path: string): MethodDecorator;
/**
* Define a PUT method route.
* @param path - The route path.
*/
export function Put(path: string): MethodDecorator;
/**
* Define middleware for a controller or specific method.
* @param middleware - Array of middleware functions.
*/
export function Middleware(
middleware: Array<
(
req: import("express").Request,
res: import("express").Response,
next: import("express").NextFunction
) => void
>
): MethodDecorator & ClassDecorator;
/**
* Create an Express router for the specified controller.
* @param controller - The controller instance or class.
* @returns Express router.
*/
export function createRouter(controller: any): Router;
/**
* Register all controllers in the specified directory to the app.
* @param app - The Express application instance.
* @param controllers - Object containing all controllers.
*/
export function registerRoutes(
app: Application,
controllers: any,
errorHandler?: import('express-serve-static-core').ErrorRequestHandler
): Promise<void>;
}