diff options
author | Abdullah Ahmed <abdullah_ahmed@brown.edu> | 2019-10-19 14:41:16 -0400 |
---|---|---|
committer | Abdullah Ahmed <abdullah_ahmed@brown.edu> | 2019-10-19 14:41:16 -0400 |
commit | 1a8292f7588880718a657a5fca5c32f1a5975205 (patch) | |
tree | 216639d9d5387ba2563b37b169c678301d671b15 /src/server/RouteSubscriber.ts | |
parent | 5e04d7f94d180dc984e48eca888ac2cedfd0c7a3 (diff) | |
parent | 3d910bae8771e67cabc1500c49b77d425fdf62e9 (diff) |
merged
Diffstat (limited to 'src/server/RouteSubscriber.ts')
-rw-r--r-- | src/server/RouteSubscriber.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/server/RouteSubscriber.ts b/src/server/RouteSubscriber.ts new file mode 100644 index 000000000..e49be8af5 --- /dev/null +++ b/src/server/RouteSubscriber.ts @@ -0,0 +1,26 @@ +export default class RouteSubscriber { + private _root: string; + private requestParameters: string[] = []; + + constructor(root: string) { + this._root = root; + } + + add(...parameters: string[]) { + this.requestParameters.push(...parameters); + return this; + } + + public get root() { + return this._root; + } + + public get build() { + let output = this._root; + if (this.requestParameters.length) { + output = `${output}/:${this.requestParameters.join("/:")}`; + } + return output; + } + +}
\ No newline at end of file |