@slowvoid.dev/express
Version:
node decorators - decorators for express library
20 lines (19 loc) • 870 B
TypeScript
import { Router, Express } from 'express';
import { Type } from './types';
import { MiddlewareFunction } from './middleware';
/**
* Attach controllers to express application
*/
export declare function attachControllers(app: Express | Router, controllers: Type[]): Promise<void>;
/**
* Attach controller instances to express application
*/
export declare function attachControllerInstances(app: Express | Router, controllers: InstanceType<Type>[]): Promise<void>;
/**
* Attach middleware to controller metadata
*
* @param {boolean} unshift if set to false all the custom decorator middlewares will be exectuted after the middlewares attached through controller
*
* Note- Please use custom decorators before express method decorators Get Post etc.
*/
export declare function attachMiddleware(target: any, property: string, middleware: MiddlewareFunction): void;