Prefer import.meta.path in http server guide (#11180)

This commit is contained in:
Kelvin Luck
2024-05-19 21:37:17 +01:00
committed by GitHub
parent 8fffe01ef3
commit dcec6906f6

View File

@@ -18,7 +18,7 @@ const server = Bun.serve({
if (path === "/abc") return Response.redirect("/source", 301);
// send back a file (in this case, *this* file)
if (path === "/source") return new Response(Bun.file(import.meta.file));
if (path === "/source") return new Response(Bun.file(import.meta.path));
// respond with JSON
if (path === "/api") return Response.json({ some: "buns", for: "you" });