taler-typescript-core

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

commit 6b313c6ca1f599f1aa681206700b43463f47b830
parent 4afc876499f6672999110330d4fd9c082019db96
Author: Sebastian <sebasjm@gmail.com>
Date:   Sat,  9 Nov 2024 16:57:24 -0300

description

Diffstat:
Mpackages/web-util/src/serve.ts | 24+++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/packages/web-util/src/serve.ts b/packages/web-util/src/serve.ts @@ -22,6 +22,7 @@ const logger = new Logger("serve.ts"); const PATHS = { WS: "/ws", EXAMPLE: "/examples", + ROOT: "/", APP: "/app", }; @@ -46,7 +47,7 @@ export async function serve(opts: { if (opts.tls) { httpsServer = https.createServer(httpServerOptions, app); httpsPort = opts.port + 1; - servers.push(httpsServer) + servers.push(httpsServer); } logger.info(`Dev server. Endpoints:`); @@ -124,6 +125,27 @@ export async function serve(opts: { ); }); + app.get(PATHS.ROOT, function (req: any, res: any) { + res.set("Content-Type", "text/html"); + res.send(`<hmtl> + <head><title>Development Server</title></head> + <body> + 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> + <dd>Where you can find the application. Reloads on update.</dd> + + <dt><a href="./examples">ui examples</a></dt> + <dd>Where you can browse static UI examples. Reloads on update.</dd> + + <dt><a href="./ws">websocket</a></dt> + <dd>Announce when the code changes</dd> + </dl> + </body> + </html>`); + }); + logger.info(`Serving ${opts.folder} on ${httpPort}: plain HTTP`); httpServer.listen(httpPort); if (httpsServer !== undefined) {