Load webdir from module path directly
This commit is contained in:
5
app.js
5
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) {
|
||||
|
Reference in New Issue
Block a user