const apiBase = ''; function apiPost(path, body) { return fetch(`${apiBase}${path}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }).then(res => res.json()); } function apiGet(path) { return fetch(`${apiBase}${path}`) .then(res => res.json()); } function showResult(id, data) { document.getElementById(id).innerText = data.message || JSON.stringify(data, null, 2); }