fixing mounted app routes, fixing sql for prod

This commit is contained in:
Sam
2026-03-11 21:47:06 +00:00
parent 5001b8203d
commit 093007bc76
2 changed files with 9 additions and 4 deletions

View File

@@ -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()