routing-controllers
Version:
Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.
16 lines • 570 B
JavaScript
import { getMetadataArgsStorage } from '../index';
/**
* Marks given class as a middleware.
* Allows to create global middlewares and control order of middleware execution.
*/
export function Middleware(options) {
return function (target) {
getMetadataArgsStorage().middlewares.push({
target: target,
type: options && options.type ? options.type : 'before',
global: true,
priority: options && options.priority !== undefined ? options.priority : 0,
});
};
}
//# sourceMappingURL=Middleware.js.map