30 lines
963 B
HTML
30 lines
963 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Test Article API</title>
|
|
<script>
|
|
async function testAPI() {
|
|
try {
|
|
const response = await fetch('http://localhost:3000/api/v1/articles?status=published');
|
|
const data = await response.json();
|
|
document.getElementById('result').innerHTML = `
|
|
<h2>API Test Result</h2>
|
|
<p>Status: ${response.status}</p>
|
|
<p>Articles found: ${data.total}</p>
|
|
<pre>${JSON.stringify(data.data[0], null, 2)}</pre>
|
|
`;
|
|
} catch (error) {
|
|
document.getElementById('result').innerHTML = `
|
|
<h2>Error</h2>
|
|
<p>${error.message}</p>
|
|
`;
|
|
}
|
|
}
|
|
window.onload = testAPI;
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1>Testing Article API</h1>
|
|
<div id="result">Loading...</div>
|
|
</body>
|
|
</html> |