8 lines
310 B
TypeScript
8 lines
310 B
TypeScript
import { getControllerMetadata } from './controller.registry';
|
|
import type { Controller } from './types';
|
|
|
|
export const Middleware = (): MethodDecorator => (target, handlerName) => {
|
|
const metadata = getControllerMetadata(target.constructor as Controller);
|
|
metadata.middlewares.push(String(handlerName));
|
|
};
|