MCPcopy Create free account
hub / github.com/ReviewStage/stage-cli / sendIndexFallback

Function sendIndexFallback

packages/cli/src/server.ts:221–236  ·  view source on GitHub ↗
(webDist: string, res: http.ServerResponse)

Source from the content-addressed store, hash-verified

219}
220
221async function sendIndexFallback(webDist: string, res: http.ServerResponse): Promise<void> {
222 const indexPath = path.join(webDist, "index.html");
223 let stat: Awaited<ReturnType<typeof fsp.stat>>;
224 try {
225 stat = await fsp.stat(indexPath);
226 } catch {
227 res.writeHead(404, { "Content-Type": "text/plain" });
228 res.end("Not Found");
229 return;
230 }
231 res.writeHead(200, {
232 "Content-Type": "text/html; charset=utf-8",
233 "Content-Length": String(stat.size),
234 });
235 await pipeline(createReadStream(indexPath), res);
236}

Callers 1

handleRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected