UNPKG

sipp

Version:

An Opinionated, High-Productivity MVC Web Framework in TypeScript

21 lines 830 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApplyAll = exports.Apply = void 0; const constants_1 = require("../constants"); const http_1 = require("../http"); const normalizeMiddleware = (middleware) => { return middleware instanceof http_1.Middleware ? middleware.bind() : middleware; }; const Apply = (...middleware) => { return function (target, key) { Reflect.defineMetadata(constants_1.MIDDLEWARE_METADATA, middleware.map(normalizeMiddleware), target, key); }; }; exports.Apply = Apply; const ApplyAll = (...middleware) => { return function (constructor) { Reflect.defineMetadata(constants_1.CONTROLLER_MIDDLEWARE_METADATA, middleware.map(normalizeMiddleware), constructor); }; }; exports.ApplyAll = ApplyAll; //# sourceMappingURL=Middleware.js.map