Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created June 2, 2023 16:12
Show Gist options
  • Save kwhinnery/6008f850ac7b74ad438a8fca28f4ddec to your computer and use it in GitHub Desktop.
Save kwhinnery/6008f850ac7b74ad438a8fca28f4ddec to your computer and use it in GitHub Desktop.
A single file application in Deno, using JSX and TypeScript
/** @jsx h */
import { serve } from "https://deno.land/std@0.190.0/http/mod.ts";
import html, { h } from "https://deno.land/x/htm@0.2.0/mod.ts";
function Greeting({ name }) {
return <h1>Hello, {name}!</h1>;
}
function handler(_req: Request): Response {
return html({
body: <Greeting name="Kevin"/>
});
}
serve(handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment