1// Dumbest possible bun HTTP server — the cold-start baseline. Mirrors the
2// effectful Sandbox's two routes (`/echo` and a default text response) so the
3// in-VM workload is identical; everything that differs in time-to-usable is
4// the alchemy/Effect abstraction, not the work the server does.
5const port = Number(process.env.PORT ?? 8080);
6
7Bun.serve({
8 port,
9 hostname: "0.0.0.0",
10 fetch(req) {
11 const url = new URL(req.url);
12 if (url.pathname === "/echo") {
13 return Response.json({ message: url.searchParams.get("message") ?? "" });
14 }
15 return new Response("hello from bun microvm");
16 },
17});
18
19console.log(`bun microvm baseline listening on :${port}`);