UNPKG

@anyhowstep/ts-route-server

Version:

27 lines 858 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const HandlerMiddleware_1 = require("./HandlerMiddleware"); class Route { constructor(definition, handlerArr = []) { this.definition = definition; this.handlerArr = handlerArr; } add(handler) { const newHandlerArr = this.handlerArr.slice(); newHandlerArr.push(HandlerMiddleware_1.HandlerMiddleware.Create(handler)); return new Route(this.definition, newHandlerArr); } addVoid(handler) { const newHandlerArr = this.handlerArr.slice(); newHandlerArr.push(handler); return new Route(this.definition, newHandlerArr); } getDefinition() { return this.definition; } getHandlerArr() { return this.handlerArr; } } exports.Route = Route; //# sourceMappingURL=Route.js.map