#bun.serve runs twice
1 messages · Page 1 of 1 (latest)
Try console.log(req.url) I think you'll find that your browser is sending 2 requests
oh spot on! The second request is for the favicon. Do you know how i could disable the favicon from generating another response?
Bun.serve({
fetch(req) {
const { pathname } = new URL(req.url);
if (pathname === "/favicon.ico") {
return new Response(null, { status: 204 });
}
return new Response("Bun!");
},
});