-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.ts
More file actions
26 lines (23 loc) · 724 Bytes
/
Copy pathdemo.ts
File metadata and controls
26 lines (23 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import path from "node:path";
import { fileURLToPath } from "node:url";
import express, { Router, type Router as RouterType } from "express";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
/**
* Resolves to `<repo root>/demo/`. The demo/host.html file embeds the widget
* loader and lets us smoke-test the full flow locally without a separate
* static server.
*/
const DEFAULT_DEMO_DIR = path.resolve(__dirname, "../../../../demo");
export function buildDemoRouter(
demoDir: string = DEFAULT_DEMO_DIR,
): RouterType {
const router: RouterType = Router();
router.use(
"/demo",
express.static(demoDir, {
fallthrough: false,
index: "host.html",
}),
);
return router;
}