UNPKG

1.15 kBJavaScriptView Raw
1"use strict";
2// Copyright IBM Corp. and LoopBack contributors 2018,2020. All Rights Reserved.
3// Node module: @loopback/rest
4// This file is licensed under the MIT License.
5// License text available at https://opensource.org/licenses/MIT
6Object.defineProperty(exports, "__esModule", { value: true });
7exports.RouteSource = exports.BaseRoute = void 0;
8/**
9 * Base implementation of RouteEntry
10 */
11class BaseRoute {
12 /**
13 * Construct a new route
14 * @param verb - http verb
15 * @param path - http request path pattern
16 * @param spec - OpenAPI operation spec
17 */
18 constructor(verb, path, spec) {
19 this.path = path;
20 this.spec = spec;
21 this.verb = verb.toLowerCase();
22 }
23 describe() {
24 return `${this.verb} ${this.path}`;
25 }
26 toString() {
27 return `${this.constructor.name} - ${this.describe()}`;
28 }
29}
30exports.BaseRoute = BaseRoute;
31class RouteSource {
32 constructor(value) {
33 this.value = value;
34 this.type = 'route';
35 }
36 toString() {
37 return this.value.toString();
38 }
39}
40exports.RouteSource = RouteSource;
41//# sourceMappingURL=base-route.js.map
\No newline at end of file