summaryrefslogtreecommitdiff
path: root/cli/bench/http/deno_reactdom_ssr_flash.jsx
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-08-18 17:35:02 +0530
committerGitHub <noreply@github.com>2022-08-18 17:35:02 +0530
commitcd21cff29942f24ba7d38287186cce64d0e84e56 (patch)
treee663eff884526ee762ae9141a3cf5a0f6967a84e /cli/bench/http/deno_reactdom_ssr_flash.jsx
parent0b0843e4a54d7c1ddf293ac1ccee2479b69a5ba9 (diff)
feat(ext/flash): An optimized http/1.1 server (#15405)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com> Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl> Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/bench/http/deno_reactdom_ssr_flash.jsx')
-rw-r--r--cli/bench/http/deno_reactdom_ssr_flash.jsx26
1 files changed, 26 insertions, 0 deletions
diff --git a/cli/bench/http/deno_reactdom_ssr_flash.jsx b/cli/bench/http/deno_reactdom_ssr_flash.jsx
new file mode 100644
index 000000000..571545b27
--- /dev/null
+++ b/cli/bench/http/deno_reactdom_ssr_flash.jsx
@@ -0,0 +1,26 @@
+import { renderToReadableStream } from "https://esm.run/react-dom/server";
+import * as React from "https://esm.run/react";
+const { serve } = Deno;
+const addr = Deno.args[0] || "127.0.0.1:4500";
+const [hostname, port] = addr.split(":");
+
+const App = () => (
+ <html>
+ <body>
+ <h1>Hello World</h1>
+ </body>
+ </html>
+);
+
+const headers = {
+ headers: {
+ "Content-Type": "text/html",
+ },
+};
+
+serve(
+ async () => {
+ return new Response(await renderToReadableStream(<App />), headers);
+ },
+ { hostname, port },
+);