dev-server-cli
Version:
Quickly start a local service to implement testing and file transfer
25 lines • 786 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Proxy</title>
</head>
<body>
<button id="proxyBtn">请求代理API</button>
<pre id="result"></pre>
<script>
document.getElementById('proxyBtn').onclick = async function() {
const resultEl = document.getElementById('result');
resultEl.textContent = '请求中...';
try {
// 示例:代理到 /api/proxy/get?foo=bar
const resp = await fetch('/api/_health');
const text = await resp.text();
resultEl.textContent = `状态: ${resp.status}\n` + text;
} catch (e) {
resultEl.textContent = '请求失败: ' + e;
}
}
</script>
</body>
</html>