MCPcopy Create free account
hub / github.com/dfee/rbx / serveScript

Function serveScript

examples/with-script/src/index.js:7–13  ·  view source on GitHub ↗
(app, relpath, publicName = undefined)

Source from the content-addressed store, hash-verified

5const port = 3000;
6
7const serveScript = (app, relpath, publicName = undefined) => {
8 const abspath = path.resolve(path.join(__dirname, relpath));
9 const filename = path.basename(abspath);
10 app.get(`/scripts/${publicName || filename}`, (req, res) =>
11 res.sendFile(abspath),
12 );
13};
14
15app.get("/", (req, res) => res.sendFile(path.join(__dirname, "index.html")));
16

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…