magento-destroyers/index.ts
2025-07-26 16:43:54 +02:00

33 lines
826 B
TypeScript

// Following CLAUDE.md instructions for serving HTML with Bun
import indexHtml from "./build/index.html";
Bun.serve({
port: 3001,
routes: {
"/": indexHtml,
// Serve static files
"/*": async (req) => {
const url = new URL(req.url);
const path = url.pathname;
try {
// Try to serve file from build directory
const file = Bun.file(`./build${path}`);
if (await file.exists()) {
return new Response(file);
}
} catch (e) {
// File not found
}
// Fallback to index.html for client-side routing
return new Response(Bun.file("./build/index.html"));
}
},
development: {
hmr: false, // Disable HMR for production build
console: true,
}
});
console.log("Server running at http://localhost:3001");