Welcome to my page
function sendQuery() {
const name = document.getElementById('queryName').value;
fetch(`/api/query?name=${encodeURIComponent(name)}`)
.then(res => res.json())
.then(data => {
document.getElementById('queryResult').textContent = data.message;
});
}
function sendUrl() {
const id = document.getElementById('urlId').value;
fetch(`/api/url/${encodeURIComponent(id)}`)
.then(res => res.json())
.then(data => {
document.getElementById('urlResult').textContent = data.message;
});
}
function sendBody() {
const name = document.getElementById('bodyName').value;
fetch('/api/body', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name })
})
.then(res => res.json())
.then(data => {
document.getElementById('bodyResult').textContent = data.message;
});
}