-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
477 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { serveHeadToHead } from "../../../src/server/head-to-head/main"; | ||
import { barelyServeSite } from "./barelyServeSite"; | ||
|
||
await barelyServeSite("sites", /* dev */ true); | ||
await Promise.all([ | ||
barelyServeSite("sites", /* dev */ true), | ||
serveHeadToHead(), | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
Bun.serve({ | ||
fetch(req, server) { | ||
// upgrade the request to a WebSocket | ||
if (server.upgrade(req)) { | ||
return; // do not return a Response | ||
} | ||
return new Response("Upgrade failed", { status: 500 }); | ||
}, | ||
websocket: {}, // handlers | ||
}); | ||
import { serve } from "bun"; | ||
|
||
export async function serveHeadToHead() { | ||
return serve({ | ||
port: 3456, | ||
fetch(req, server) { | ||
// upgrade the request to a WebSocket | ||
if (server.upgrade(req)) { | ||
return; // do not return a Response | ||
} | ||
}, | ||
websocket: { | ||
message(ws, message) { | ||
console.log(message); | ||
}, | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"skipLibCheck": true, | ||
"types": ["bun"] | ||
}, | ||
"include": ["src/cubing", "node_modules/@types/node"] | ||
} |
Oops, something went wrong.