1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
const search = url.searchParams;
const name = search.get("name") || "anonymous";
return new Response(
`
<html>
<body>
<h1>Hello, ${name}!</h1>
<a href="${import.meta.url.replace("esm.town", "val.town")}">View Source</a>
</body>
</html>
`,
{ headers: { "Content-Type": "text/html" } },
);
}