Function
serveStatic
(
res: ServerResponse,
pathname: string,
opts: ServerOptions,
)
Source from the content-addressed store, hash-verified
| 39 | }; |
| 40 | |
| 41 | export async function serveStatic( |
| 42 | res: ServerResponse, |
| 43 | pathname: string, |
| 44 | opts: ServerOptions, |
| 45 | ): Promise<boolean> { |
| 46 | if (!opts.staticRoot) return false; |
| 47 | const relative = pathname === "/" || pathname === "/viewer" ? "/index.html" : pathname; |
| 48 | return await tryServe(res, opts.staticRoot, relative); |
| 49 | } |
| 50 | |
| 51 | async function tryServe( |
| 52 | res: ServerResponse, |
Tested by
no test coverage detected