taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 916220c53a8be287ffacad3251ddebff33bbe4f2
parent 9b1186d642b447acab7dd321d46dbaa3654565d7
Author: Florian Dold <florian@dold.me>
Date:   Sun,  6 Apr 2025 11:55:54 +0200

kyc-ui: use same path for dev server as in production

Diffstat:
Mpackages/kyc-ui/dev.mjs | 2++
Mpackages/web-util/src/serve.ts | 19++++++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/packages/kyc-ui/dev.mjs b/packages/kyc-ui/dev.mjs @@ -43,4 +43,6 @@ serve({ port: 8080, source: "./src", onSourceUpdate: build, + appSamplePath: "/kyc-spa/ZBNB5AS4F4MARC983KZ64EMHHNWGF9GDD4J0CA4EPCVERCEK64S0", + appPath: "/kyc-spa/:token", }); diff --git a/packages/web-util/src/serve.ts b/packages/web-util/src/serve.ts @@ -19,12 +19,6 @@ const httpServerOptions = { const logger = new Logger("serve.ts"); -const PATHS = { - WS: "/ws", - EXAMPLE: "/examples", - ROOT: "/", - APP: "/app", -}; export async function serve(opts: { folder: string; @@ -34,7 +28,18 @@ export async function serve(opts: { examplesLocationJs?: string; examplesLocationCss?: string; onSourceUpdate?: () => Promise<void>; + appPath?: string; + appSamplePath?: string; }): Promise<void> { + + const PATHS = { + WS: "/ws", + EXAMPLE: "/examples", + ROOT: "/", + APP: opts.appPath ?? "/app", + }; + + const app = express(); app.use(PATHS.APP, express.static(opts.folder)); @@ -133,7 +138,7 @@ export async function serve(opts: { it will connect to this server using websocket and reload automatically when the code changes <h1>Endpoints</h1> <dl> - <dt><a href="./app">app</a></dt> + <dt><a href=".${opts.appSamplePath ?? "/app"}">app</a></dt> <dd>Where you can find the application. Reloads on update.</dd> <dt><a href="./examples">ui examples</a></dt>