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
27
28
29
30
31
32
33
34
35
/**
* @title Running React on the Client
* @description Vals can also be used to host client-side code!
* @preview https://pomdtr-react_example_server.web.val.run
* @include pomdtr/react_example_client
* @resource [React - Quick Start](https://react.dev/learn)
*/
// The server response includes a script referencing the client val
export const server = (req) =>
new Response(
`<html>
<head>
<title>TLDraw React Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<style>
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@500;700&display=swap");
@import url("https://esm.sh/tldraw/tldraw.css");
body {
font-family: "Inter";
}
</style>
</head>
<body>
<main id="root"></main>
<script type="module" src="https://esm.town/v/iamseeley/reacttldrawclient"></script>
</body>
</html>`,
{
headers: {
"Content-Type": "text/html",
},
},
);
iamseeley-react_tldraw.web.val.run
June 5, 2024