15 lines
327 B
TypeScript
Raw Normal View History

2024-12-29 23:00:38 -05:00
import { serveDir, serveFile } from "jsr:@std/http/file-server";
Deno.serve((req: Request) => {
const pathname = new URL(req.url).pathname;
if (pathname.startsWith("/static")) {
return serveDir(req, {
fsRoot: "src/static",
urlRoot: "static",
});
} else {
return serveFile(req, "src/static/index.html");
}
});