From 093007bc76a03021592eafaa24d08907c24ef7b1 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 11 Mar 2026 21:47:06 +0000 Subject: [PATCH] fixing mounted app routes, fixing sql for prod --- server/db/sql.js | 3 +-- server/index.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/db/sql.js b/server/db/sql.js index 4594330..6986f47 100644 --- a/server/db/sql.js +++ b/server/db/sql.js @@ -2,7 +2,6 @@ import postgres from 'postgres'; import 'dotenv/config' -console.log("url: ", process.env.LOCAL_DATABASE_URL) -const sql = postgres(process.env.LOCAL_DATABASE_URL); +const sql = postgres(process.env.DATABASE_URL); export default sql; \ No newline at end of file diff --git a/server/index.js b/server/index.js index 68ebd9f..1e44832 100644 --- a/server/index.js +++ b/server/index.js @@ -158,6 +158,8 @@ class Server { filePath = path.join(this.UIPath, url); } else if(url.includes("75820185")) { filePath = path.join(this.UIPath, platformFolder, url.split("75820185")[1]); + } else if(url.startsWith("/db")) { + filePath = path.join(this.DBPath, url.replace('/db', '')); } else { filePath = path.join(this.UIPath, platformFolder, "index.html"); } @@ -225,7 +227,7 @@ class Server { } } - constructor() { + async init() { this.db = new Database() this.auth = new AuthHandler() global.db = this.db @@ -265,7 +267,7 @@ class Server { app.use(this.logRequest); app.use(this.logResponse); - this.mountApps(app) + await this.mountApps(app) // must be completed before router is registered let router = express.Router(); this.registerRoutes(router) @@ -290,6 +292,10 @@ class Server { Object.preventExtensions(this); } + + constructor() { + this.init() + } } const server = new Server() \ No newline at end of file