Created
April 15, 2022 23:48
-
-
Save davydkov/3d34d51a9dfb5af364e6c9b56f2b58a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx h */ | |
/// <reference no-default-lib="true"/> | |
/// <reference lib="dom" /> | |
/// <reference lib="dom.asynciterable" /> | |
/// <reference lib="deno.ns" /> | |
import { serve } from "https://deno.land/[email protected]/http/server.ts"; | |
import { h, renderSSR } from "https://deno.land/x/[email protected]/mod.ts"; | |
function App() { | |
return ( | |
<html> | |
<head> | |
<title>Hello from JSX</title> | |
</head> | |
<body> | |
<h1>Hello world</h1> | |
</body> | |
</html> | |
); | |
} | |
function handler(req) { | |
const html = renderSSR(<App />); | |
return new Response(html, { | |
headers: { | |
"content-type": "text/html", | |
}, | |
}); | |
} | |
console.log("Listening on http://localhost:8000"); | |
serve(handler); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment