Skip to content

Commit cf4d14e

Browse files
feat: 修改根路径返回极简HTML页面
- 将根路径 / 的响应从纯文本改为极简HTML页面 - 包含基本的HTML结构和服务器状态信息 - 设置正确的content-type为text/html
1 parent 772498e commit cf4d14e

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

deno-proxy/src/main.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,20 @@ serve((req) => {
251251
const url = new URL(req.url);
252252

253253
if (req.method === "GET" && url.pathname === "/") {
254-
return new Response("OK", { status: 200 });
254+
const html = `<!DOCTYPE html>
255+
<html>
256+
<head>
257+
<title>Deno Proxy</title>
258+
</head>
259+
<body>
260+
<h1>Deno Proxy Server</h1>
261+
<p>Server is running</p>
262+
</body>
263+
</html>`;
264+
return new Response(html, {
265+
status: 200,
266+
headers: { "content-type": "text/html" }
267+
});
255268
}
256269

257270
if (req.method === "GET" && url.pathname === "/healthz") {

0 commit comments

Comments
 (0)