Load webdir from module path directly

This commit is contained in:
2025-07-06 17:20:50 +02:00
parent ca732c1306
commit c1df1e092e

5
app.js
View File

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