aboutsummaryrefslogtreecommitdiff
path: root/src/server/RouteSubscriber.ts
diff options
context:
space:
mode:
authorFawn <fangrui_tong@brown.edu>2019-10-24 10:44:13 -0400
committerFawn <fangrui_tong@brown.edu>2019-10-24 10:44:13 -0400
commit0f72e2acc66698247503246887a5f5bb572b2753 (patch)
tree9e50a4259e26ef50c31894a7e9b1e6282a267412 /src/server/RouteSubscriber.ts
parent45074de50007e0693df8835643464da962e62620 (diff)
parent31166219e473e105b8fd9d49627fd1df58822c55 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into textbox_fawn_fix
Diffstat (limited to 'src/server/RouteSubscriber.ts')
-rw-r--r--src/server/RouteSubscriber.ts26
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