async function main() { const response = await fetch('/videos'); const videos = await response.json(); const videoDiv = document.getElementById('videos'); videoDiv.innerHTML = ''; for (const video of videos) { const button = document.createElement('button'); button.textContent = video.name; button.addEventListener('click', () => { fetch(`/play?video=${video.path}`, { method: 'POST' }); }); videoDiv.appendChild(button); } } main();