mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
22 lines
354 B
TypeScript
22 lines
354 B
TypeScript
const server = Bun.serve({
|
|
port: 0,
|
|
async fetch(req) {
|
|
console.log(await req.json());
|
|
return new Response();
|
|
},
|
|
});
|
|
console.log(
|
|
JSON.stringify({
|
|
hostname: server.hostname,
|
|
port: server.port,
|
|
}),
|
|
);
|
|
|
|
(async function () {
|
|
for await (let line of console) {
|
|
if (line === "--CLOSE--") {
|
|
process.exit(0);
|
|
}
|
|
}
|
|
})();
|