vibe coding is the best

This commit is contained in:
2026-03-20 18:22:15 -05:00
parent 1075b59d2d
commit 8854e13671
6 changed files with 1988 additions and 1960 deletions

View File

@@ -2,14 +2,19 @@ import { readFileSync } from "fs";
import { handleMessage, handleClose } from "./ws-handler";
const HTML = readFileSync("./src/public/index.html", "utf-8");
const CSS = readFileSync("./src/public/styles.css", "utf-8");
const JS = readFileSync("./src/public/script.js", "utf-8");
const server = Bun.serve({
port: 3000,
fetch(req, server) {
if (new URL(req.url).pathname === "/ws") {
const url = new URL(req.url);
if (url.pathname === "/ws") {
if (!server.upgrade(req)) return new Response("WS upgrade failed", { status: 400 });
return undefined as any;
}
if (url.pathname === "/styles.css") return new Response(CSS, { headers: { "Content-Type": "text/css" } });
if (url.pathname === "/script.js") return new Response(JS, { headers: { "Content-Type": "text/javascript" } });
return new Response(HTML, { headers: { "Content-Type": "text/html; charset=utf-8" } });
},
websocket: {