aboutsummaryrefslogtreecommitdiff
path: root/examples/react-file-system-router/index.tsx
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-03-02 19:05:21 -0800
committerGravatar GitHub <noreply@github.com> 2023-03-02 19:05:21 -0800
commitf7d6cc0ddf8aa75a8c7b6fb23a787c52648f2e8a (patch)
treed29a4cae43dd8fbb36e67a82f929430735af4b5b /examples/react-file-system-router/index.tsx
parent38d6cd6d15f2745d02fc757cc299691d82c7b4f5 (diff)
parent9388b3f8257bc2e580deaece4cd2677928104fc6 (diff)
downloadbun-f7d6cc0ddf8aa75a8c7b6fb23a787c52648f2e8a.tar.gz
bun-f7d6cc0ddf8aa75a8c7b6fb23a787c52648f2e8a.tar.zst
bun-f7d6cc0ddf8aa75a8c7b6fb23a787c52648f2e8a.zip
Merge branch 'main' into ciro/spawn-abort-signal-rebased
Diffstat (limited to 'examples/react-file-system-router/index.tsx')
-rw-r--r--examples/react-file-system-router/index.tsx22
1 files changed, 9 insertions, 13 deletions
diff --git a/examples/react-file-system-router/index.tsx b/examples/react-file-system-router/index.tsx
index a784c393b..62d1151d5 100644
--- a/examples/react-file-system-router/index.tsx
+++ b/examples/react-file-system-router/index.tsx
@@ -1,24 +1,20 @@
// A simple way to connect FileSystemRouter to Bun#serve
// run with `bun run index.tsx`
-import { renderToReadableStream } from 'react-dom/server'
-import { FileSystemRouter } from 'bun'
+import { renderToReadableStream } from "react-dom/server";
+import { FileSystemRouter } from "bun";
export default {
port: 3000,
async fetch(request: Request) {
const router = new FileSystemRouter({
dir: process.cwd() + "/pages",
- style: "nextjs"
- })
+ style: "nextjs",
+ });
- const route = router.match(request)
+ const route = router.match(request);
- const { default: Root } = await import(route.filePath)
- return new Response(
- await renderToReadableStream(
- <Root {...route.params} />
- )
- )
- }
-} \ No newline at end of file
+ const { default: Root } = await import(route.filePath);
+ return new Response(await renderToReadableStream(<Root {...route.params} />));
+ },
+};