MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / get

Function get

__tests__/cli-ui-command.test.ts:51–66  ·  view source on GitHub ↗

GET a path from a running viewer, with a valid loopback Host.

(port: number, requestPath: string)

Source from the content-addressed store, hash-verified

49
50/** GET a path from a running viewer, with a valid loopback Host. */
51function get(port: number, requestPath: string): Promise<{ status: number; body: string }> {
52 return new Promise((resolve, reject) => {
53 const req = http.request(
54 { host: '127.0.0.1', port, path: requestPath, method: 'GET' },
55 (res) => {
56 const chunks: Buffer[] = [];
57 res.on('data', (c: Buffer) => chunks.push(c));
58 res.on('end', () =>
59 resolve({ status: res.statusCode ?? 0, body: Buffer.concat(chunks).toString('utf-8') })
60 );
61 }
62 );
63 req.on('error', reject);
64 req.end();
65 });
66}
67
68/**
69 * Start `codegraph ui` and wait for the URL it prints.

Callers 1

Calls 4

pushMethod · 0.80
resolveFunction · 0.70
requestMethod · 0.65
onMethod · 0.65

Tested by

no test coverage detected