Update http-file.ts

This commit is contained in:
Jarred Sumner
2022-05-08 01:13:03 -07:00
parent 61afb8955c
commit 4dee9be3eb

View File

@@ -2,11 +2,7 @@ const { serve, file, resolveSync } = Bun;
const { path } = import.meta;
serve({
fetch(req: Request) {
const modulePath = resolveSync(
new URL(req.url).pathname.substring(1),
path
);
return new Response(file(modulePath));
return new Response(file(new URL(req.url).pathname.substring(1)));
},
// this is called when fetch() throws or rejects