From c1df1e092e76be8c5d3355a18b48e507c2a3a040 Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 6 Jul 2025 17:20:50 +0200 Subject: [PATCH] Load webdir from module path directly --- app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 331b646..a290ddd 100755 --- a/app.js +++ b/app.js @@ -1,6 +1,8 @@ #!/usr/bin/env node import express from 'express'; +import path from 'path'; +import { fileURLToPath } from 'url'; import {createClient} from 'db-vendo-client/index.js'; import {profile as dbnavProfile} from 'db-vendo-client/p/dbnav/index.js'; import {mapRouteParsers} from 'db-vendo-client/lib/api-parsers.js'; @@ -24,6 +26,7 @@ const config = { }; const start = async () => { + const webdir = path.join(path.dirname(fileURLToPath(import.meta.url)), 'web'); const app = express(); @@ -35,7 +38,7 @@ const start = async () => { const api = await createApi(vendo, config); app.use("/api", api); - app.use('/web', express.static('web')); + app.use('/web', express.static(webdir)); app.listen(config.port, (err) => { if (err) {