Open SaltFish001 opened 3 weeks ago
import http from "0http-bun"; import nested from "0http-bun/lib/router/sequential"; import { renderToReadableStream } from "react-dom/server"; import App from "./views"; const { router } = http({ port: 3000, }); const test2 = nested(); test2.get("/test", () => { return Response.json({ hello: "hello" }); }); router.use("/api", test2); router.get("/", async (_req) => { // jump to view page return Response.redirect("/view"); }); router.get("/view", async (_req) => { const stream = await renderToReadableStream(<App name="World" />); return new Response(stream, { headers: { "Content-Type": "text/html" }, }); }); export default router;
but i got this:
but i got this: