aboutsummaryrefslogtreecommitdiff
path: root/examples/react-file-system-router/index.tsx
diff options
context:
space:
mode:
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} />));
+ },
+};