Files
L2keka/server/read-standard.js
T

31 lines
956 B
JavaScript

const BASE = 'http://localhost:3002';
const SID = '48e1344e-9616-4bf2-b177-d779bddad2e8';
async function main() {
const login = await fetch(`${BASE}/api/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ password: '620f4c96' })
});
const { token } = await login.json();
const auth = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` };
const r = await fetch(`${BASE}/api/standards/${SID}`, { headers: auth });
const s = await r.json();
console.log('Standard:', JSON.stringify({
id: s.id,
name: s.name,
category_tag: s.category_tag,
content_length: s.content?.length
}, null, 2));
// Parse content
const dims = s.content.split('\n').filter(l => l.startsWith('## '));
console.log('Dimensions from content:', dims.length);
for (const d of dims) {
console.log(' -', d.replace('## ', ''));
}
}
main().catch(console.error);