UNPKG

@methodus/server

Version:
26 lines 1.27 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 ClientConfiguration(controller, methodType, serverType, resolver) { return function (target) { var original = target.prototype.constructor; original.prototype.options = original.prototype.options || { servers: [], classes: [], plugins: [] }; original.prototype.options.classes.push({ controller: controller, methodType: methodType, serverType: serverType, resolver: resolver }); // 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.ClientConfiguration = ClientConfiguration; //# sourceMappingURL=client.js.map