nbaschez-htmlexample.web.val.run
Readme

HTML example

This is an example of how to return an HTML response.

You can also preview it at https://andreterron-htmlExample.web.val.run?name=Andre

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// View at https://andreterron-htmlExample.web.val.run?name=Andre
export default async function(req: Request): Promise<Response> {
const query = new URL(req.url).searchParams;
// Read name from the querystring or body. Defaults to "you" if not present.
const name = query.get("name") || (await req.json().catch(() => ({}))).name || "you";
// Returns the HTML response
return new Response(
`<h1>Embed webpage</h1><div><iframe width="764" height="408" src="https://www.youtube.com/embed/z__MGbOJhiQ" title="Welcome to Lex - Getting Started Guide" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; pic
{
headers: { "Content-Type": "text/html" },
},
);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
July 20, 2024