-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-connection.html
More file actions
51 lines (47 loc) · 2.13 KB
/
test-connection.html
File metadata and controls
51 lines (47 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
<head>
<title>Backend Connection Test</title>
</head>
<body>
<h1>Backend Connection Test</h1>
<button onclick="testBackend()">Test Backend Connection</button>
<button onclick="testSuno()">Test Suno API</button>
<div id="results"></div>
<script>
async function testBackend() {
const results = document.getElementById('results');
results.innerHTML = '<p>Testing backend connection...</p>';
try {
const response = await fetch('http://localhost:5001/api/health');
if (response.ok) {
const data = await response.json();
results.innerHTML = `<p style="color: green;">✅ Backend is working! Status: ${data.status}</p>`;
} else {
results.innerHTML = `<p style="color: red;">❌ Backend responded with status: ${response.status}</p>`;
}
} catch (error) {
results.innerHTML = `<p style="color: red;">❌ Backend connection failed: ${error.message}</p>`;
}
}
async function testSuno() {
const results = document.getElementById('results');
results.innerHTML = '<p>Testing Suno API connection...</p>';
try {
const response = await fetch('https://studio-api.prod.suno.com/api/v2/external/hackmit/clips?ids=test', {
headers: {
'Authorization': 'Bearer b605c69954184dd29c983b8f510b5719'
}
});
if (response.ok) {
results.innerHTML = `<p style="color: green;">✅ Suno API is accessible! Status: ${response.status}</p>`;
} else {
results.innerHTML = `<p style="color: orange;">⚠️ Suno API responded with status: ${response.status} (this might be expected for test ID)</p>`;
}
} catch (error) {
results.innerHTML = `<p style="color: red;">❌ Suno API connection failed: ${error.message}</p>`;
}
}
</script>
</body>
</html>