Return HTML
This example displays a simple and small HTML page.
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const html = `<!DOCTYPE html>
<body>
<h1>Hello World</h1>
<pThis is a sample HTML for Arvancloud Edge Compute.</p>
</body>`;
return new Response(html, {
headers: {
"content-type": "text/html;charset=UTF-8",
},
});
}