The best way to control Claude Code, Codex and more from any computer or phone

main
js 22 lines 890 Bytes
Raw
1 // Dumbest possible node HTTP server — the node 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 the
4 // alchemy/Effect abstraction, not the work the server does.
5 const http = require("node:http");
6
7 const port = Number(process.env.PORT ?? 8080);
8
9 http
10 .createServer((req, res) => {
11 const url = new URL(req.url, "http://microvm");
12 if (url.pathname === "/echo") {
13 res.writeHead(200, { "content-type": "application/json" });
14 res.end(JSON.stringify({ message: url.searchParams.get("message") ?? "" }));
15 return;
16 }
17 res.writeHead(200, { "content-type": "text/plain" });
18 res.end("hello from node microvm");
19 })
20 .listen(port, "0.0.0.0", () => {
21 console.log(`node microvm baseline listening on :${port}`);
22 });