Files
crossws/playground/bun.ts
2023-12-07 01:41:02 +01:00

20 lines
472 B
TypeScript

// You can run this demo using `bun --bun ./bun.ts` or `npm run play:bun` in repo
import bunAdapter from "../src/adapters/bun";
import { createDemo, indexHTMLURL } from "./_common";
const adapter = createDemo(bunAdapter);
Bun.serve({
port: 3001,
fetch(req, server) {
if (server.upgrade(req)) {
return;
}
return new Response(Bun.file(indexHTMLURL), {
headers: { "Content-Type": "text/html" },
});
},
websocket: adapter.websocket,
});