diff options
Diffstat (limited to 'bench/react-hello-world/react-hello-world.deno.jsx')
-rw-r--r-- | bench/react-hello-world/react-hello-world.deno.jsx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bench/react-hello-world/react-hello-world.deno.jsx b/bench/react-hello-world/react-hello-world.deno.jsx new file mode 100644 index 000000000..2b0bb9b74 --- /dev/null +++ b/bench/react-hello-world/react-hello-world.deno.jsx @@ -0,0 +1,25 @@ +import { renderToReadableStream } from "https://esm.run/react-dom/server"; +import { serve } from "https://deno.land/std@0.146.0/http/server.ts"; +import * as React from "https://esm.run/react"; + +const App = () => ( + <html> + <body> + <h1>Hello World</h1> + </body> + </html> +); + +const headers = { + headers: { + "Content-Type": "text/html", + "Cache-Control": "no-transform", // disables response body auto compression, see https://deno.land/manual/runtime/http_server_apis#automatic-body-compression + }, +}; + +await serve( + async (req) => { + return new Response(await renderToReadableStream(<App />), headers); + }, + { port: 8080 } +); |