serveStatic for single file is not work
hashrock opened this issue · comments
hashrock commented
version: sift 0.4.1, deno 1.15.2, Ubuntu with WSL
Repro
code(retrieved from the documentation):
import { serve, serveStatic } from "https://deno.land/x/sift@0.4.1/mod.ts";
serve({
"/test": serveStatic("public/index.html", { baseUrl: import.meta.url }),
});
and I opened http://localhost:8000/test
then I got:
Error serving request: Error: Not a directory (os error 20), open '/mnt/c/code/deno/study-deploy-sift/public/index.html/undefined'
at async open (deno:runtime/js/40_files.js:51:17)
at async Object.readFile (deno:runtime/js/40_read_file.js:20:18)
at async Object./test (https://deno.land/x/sift@0.4.1/mod.ts:176:20)
at async handleRequest (https://deno.land/x/sift@0.4.1/mod.ts:79:24)
at async Server.#respond (https://deno.land/std@0.111.0/http/server.ts:350:24)
GET /test 6ms 500
Satya Rohith commented
@hashrock, thanks for opening the issue. The fix seems to be not published to the registry. I created a tag with broken code and re-created it on GitHub, but the registry has the old tag hence the bug. Check out 0.4.2
.
import { serve, serveStatic } from "https://deno.land/x/sift@0.4.2/mod.ts";
serve({
"/test": serveStatic("public/index.html", { baseUrl: import.meta.url }),
});
hashrock commented
It works! Thank you👍