forked from boshify/style-stealer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-api.js
More file actions
34 lines (31 loc) · 1.01 KB
/
Copy pathtest-api.js
File metadata and controls
34 lines (31 loc) · 1.01 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
// Quick test script for the API
const testUrl = 'https://blog.gtowizard.com/the-science-of-poker-performance/';
console.log('Testing API with URL:', testUrl);
console.log('Starting request...\n');
fetch('http://localhost:3002/api/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ url: testUrl }),
})
.then((res) => {
console.log('Response status:', res.status);
return res.json();
})
.then((data) => {
console.log('\n=== RESPONSE ===');
if (data.success) {
console.log('✓ Success!');
console.log('Generation time:', data.generationTime, 'ms');
console.log('Markdown length:', data.markdown?.length, 'chars');
console.log('\nFirst 500 chars of markdown:');
console.log(data.markdown?.substring(0, 500));
} else {
console.log('✗ Error:', data.error);
}
})
.catch((error) => {
console.error('✗ Request failed:', error.message);
});
console.log('Request sent, waiting for response...');