diff --git a/favicon.ico b/favicon.ico new file mode 100755 index 0000000..3dce3a5 Binary files /dev/null and b/favicon.ico differ diff --git a/server.ts b/server.ts index 2c2afb5..0375f6c 100644 --- a/server.ts +++ b/server.ts @@ -10,9 +10,14 @@ const HEADERS_STYLESHEET = { "Content-Type": "text/css", }, }; +const HEADERS_FAVICON = { + headers: { + "Content-Type": "image/x-icon", + }, +}; async function htmlDoc(body: string, head: string): Promise { - return `${head}${body}` + return `${head}${body}` } async function createBoard(width: number, height: number, mines: number): Promise { @@ -98,8 +103,7 @@ Bun.serve({ const url = new URL(request.url); if (url.pathname === "/favicon.ico") { - // TODO: Add favicon - return new Response("Not found", { status: 404, statusText: "Not found" }); + return new Response(await Bun.file("favicon.ico").arrayBuffer(), FAVICON_STYLESHEET); } if (url.pathname === "/style.css") {