deno and tauri work and start

todo: fix deno that it displays page in /static
This commit is contained in:
2024-12-23 14:06:31 -04:00
parent b9fe6f8882
commit 56cc15fef5
11 changed files with 284 additions and 67 deletions

23
frontend/server.ts Normal file
View File

@@ -0,0 +1,23 @@
import { serveDir, serveFile } from "jsr:@std/http/file-server";
Deno.serve({port: 3000}, (req: Request) => {
const pathname = new URL(req.url).pathname;
if (pathname === "/simple_file") {
return serveFile(req, "./path/to/file.txt");
}
if (pathname.startsWith("/static")) {
return serveDir(req, {
fsRoot: "public",
urlRoot: "static",
});
}
return new Response("404: Not Found", {
status: 404,
});
});