This topic provides sample code that shows how to return an HTML page.
Sample code
const html = `<!DOCTYPE html>
<body>
<h1>Hello</h1>
<p>EdgeRoutine</p>
</body>`
async function handleRequest(request) {
return new Response(html, {
headers: {
"content-type": "text/html;charset=UTF-8",
},
})
}
addEventListener("fetch", event => {
return event.respondWith(handleRequest(event.request))
})