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
import { html } from "https://esm.town/v/stevekrouse/html?v=5";
export const form_demo = async (req: Request) => {
const title = "Val Town Forms";
const formEndpoint = "https://andreterron-form_handler.web.val.run";
return html(`
<html>
<head>
<title>${title}</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://unpkg.com/mvp.css">
<style>
body {
padding: 32px;
}
form {
margin: 64px auto;
}
input {
padding: 4px;
}
</style>
</head>
<body>
<form
action="${formEndpoint}"
method="post">
<label for="username">Val Town username:</label>
<input name="username" type="text">
<button type="submit">Submit</button>
</form>
</body>
</html>`);
};