UNPKG

@methodus/server

Version:
26 lines 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); require("reflect-metadata"); let metadataKey = 'methodus'; /** the MethodConfig decorator registers the controller as a router * @param {string} name - the identifier of the controller in the resolver. * @param {Function[]} middlewares - an array of middlewares to apply to this controller} */ function PluginConfiguration(name) { return function (target) { var original = target.prototype.constructor; original.prototype.options = original.prototype.options || { servers: [], classes: [], plugins: [] }; original.prototype.options.plugins.push(name); // the new constructor behaviour var f = function () { let instance = new original(target.prototype.options); return instance; }; // copy prototype so intanceof operator still works f.prototype = original.prototype; // return new constructor (will override original) return f; }; } exports.PluginConfiguration = PluginConfiguration; //# sourceMappingURL=plugin.js.map