Files
Church-Music/legacy-site/scripts/html/test_api.html

41 lines
1.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Test</title>
</head>
<body>
<h1>House of Prayer - API Test</h1>
<div id="status"></div>
<div id="profiles"></div>
<div id="plans"></div>
<script>
const statusDiv = document.getElementById('status');
const profilesDiv = document.getElementById('profiles');
const plansDiv = document.getElementById('plans');
async function testAPI() {
try {
// Test profiles
const profileRes = await fetch('http://localhost:5000/api/profiles');
const profiles = await profileRes.json();
statusDiv.innerHTML = '<p style="color: green;">✓ Backend API is working!</p>';
profilesDiv.innerHTML = '<h2>Profiles:</h2><pre>' + JSON.stringify(profiles, null, 2) + '</pre>';
// Test plans
const plansRes = await fetch('http://localhost:5000/api/plans');
const plans = await plansRes.json();
plansDiv.innerHTML = '<h2>Plans:</h2><pre>' + JSON.stringify(plans, null, 2) + '</pre>';
} catch (error) {
statusDiv.innerHTML = '<p style="color: red;">✗ Error: ' + error.message + '</p>';
}
}
testAPI();
</script>
</body>
</html>