1
2
3
4
5
6
7
8
9
10
11
12
13
// This val greets the user with their inputted name
export default async function(req: Request): Promise<Response> {
const formData = new URLSearchParams(await req.text());
const name = formData.get("name") || "stranger";
const htmlResponse = `<h1>Hello, ${name}!</h1>`;
return new Response(htmlResponse, {
headers: { "Content-Type": "text/html" },
});
}