Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/web/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Index from "../index.html";
import { Rendered } from "./render";
import { Providers } from "./render";
import path from "path";

Bun.serve({
Expand Down Expand Up @@ -66,6 +67,15 @@ const server = Bun.serve({
url.host = "localhost:16000";
const result = fetch(url.toString(), req);

if (url.pathname === "/api.json") {
return new Response(JSON.stringify(Providers), {
headers: {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*", // Helpful for local testing
},
});
}

if (url.pathname !== "/") return result;

let html = await result.then((r) => r.text());
Expand Down