deno and tauri work and start
todo: fix deno that it displays page in /static
This commit is contained in:
23
frontend/server.ts
Normal file
23
frontend/server.ts
Normal 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,
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user