Code
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 **/
import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
export default (req: Request) => {
return new Response(
renderToString(
<html>
<link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
<main>
<h1>Hello mahictn!</h1>
<p>This is your first val. Edit this text!</p>
</main>
</html>,
),
{ headers: { "Content-Type": "text/html" } },
);
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
mahictn-watchfulblackalligator.web.val.run
Updated: January 9, 2025