cloudflare worker怎么直接输出html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})

/**
* Respond to the request
* @param {Request} request
*/
html = `
这里填html代码
`
//console.log(html)
async function handleRequest(request) {
const newResponse = new Response(html)
newResponse.headers.set('Content-Type', 'text/html');
return newResponse
}

🔰本文标题: cloudflare worker怎么直接输出html

🔞本文链接: https://193.gs/cloudflareworkershuchuhtml/index.html

🌡️本文总热度