Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request): Promise<Response> {
return new Response(
renderToString(
<>
<script type="module" src="https://esm.town/v/maxm/codemirrorTsBrowser" />
<form>
<textarea id="editorSource" className="for-codemirror" name="editorSource">
{`let hasAnError: string = 10;
function increment(num: number) {
return num + 1;
}
increment('not a number');`}
</textarea>
<button id="submit" type="submit">Submit</button>
</form>
<div id="editor"></div>
</>,
),
{ headers: { "content-type": "text/html" } },
);
}
maxm-whitenewt.web.val.run
May 29, 2024