Initial commit: Bun + React + Tailwind + shadcn setup

This commit is contained in:
root
2026-02-05 18:40:14 +00:00
commit 396c7a5e02
23 changed files with 1308 additions and 0 deletions

37
server.ts Normal file
View File

@@ -0,0 +1,37 @@
import { serve } from "bun";
import { join } from "path";
const DIST_DIR = "./dist";
serve({
port: 3000,
hostname: "0.0.0.0",
async fetch(req) {
const url = new URL(req.url);
let path = url.pathname;
// Default to index.html
if (path === "/") {
path = "/index.html";
}
const filePath = join(DIST_DIR, path);
try {
const file = Bun.file(filePath);
const exists = await file.exists();
if (exists) {
return new Response(file);
}
// For SPA routing, fall back to index.html
const indexFile = Bun.file(join(DIST_DIR, "index.html"));
return new Response(indexFile);
} catch (error) {
return new Response("Not Found", { status: 404 });
}
},
});
console.log("Server running at http://0.0.0.0:3000");