diff options
author | Mohammad Amoush <muhammedamoush@gmail.com> | 2019-11-12 17:11:20 -0500 |
---|---|---|
committer | Mohammad Amoush <muhammedamoush@gmail.com> | 2019-11-12 17:11:20 -0500 |
commit | 2ea0efa91072c98c185f957d8040edde2cdb4e5e (patch) | |
tree | 78576c68be7e1c157b0d293d6048a86652bf1ede /src/server/index.ts | |
parent | 341a4201997a27adeace7cb3fad48ce83b8008a7 (diff) | |
parent | 63ea273820eb5ab8388e2744fc7988f10746f25f (diff) |
added new managers to index
Diffstat (limited to 'src/server/index.ts')
-rw-r--r-- | src/server/index.ts | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/server/index.ts b/src/server/index.ts index 0cd195875..59752d6de 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -3,7 +3,6 @@ import { GoogleApiServerUtils } from "./apis/google/GoogleApiServerUtils"; import * as mobileDetect from 'mobile-detect'; import * as path from 'path'; import { Database } from './database'; -import { RouteStore } from './RouteStore'; const serverPort = 4321; import { GooglePhotosUploadUtils } from './apis/google/GooglePhotosUploadUtils'; import { Opt } from '../new_fields/Doc'; @@ -23,7 +22,7 @@ import DeleteManager from "./ApiManagers/DeleteManager"; import PDFManager from "./ApiManagers/PDFManager"; import UploadManager from "./ApiManagers/UploadManager"; -export const publicDirectory = __dirname + RouteStore.public; +export const publicDirectory = __dirname + "/public"; export const filesDirectory = publicDirectory + "/files/"; export enum Partitions { pdf_text, @@ -73,13 +72,12 @@ function routeSetter(router: RouteManager) { WebSocket.initialize(serverPort, router.isRelease); /** - * Anyone attempting to navigate to localhost at this port will - * first have to log in. + * Accessing root index redirects to home */ router.addSupervisedRoute({ method: Method.GET, - subscription: RouteStore.root, - onValidation: ({ res }) => res.redirect(RouteStore.home) + subscription: "/", + onValidation: ({ res }) => res.redirect("/home") }); const serve: OnUnauthenticated = ({ req, res }) => { @@ -90,7 +88,7 @@ function routeSetter(router: RouteManager) { router.addSupervisedRoute({ method: Method.GET, - subscription: [RouteStore.home, new RouteSubscriber("/doc").add("docId")], + subscription: ["/home", new RouteSubscriber("doc").add("docId")], onValidation: serve, onUnauthenticated: ({ req, ...remaining }) => { const { originalUrl: target } = req; |