Os vídeos não aparecem no server, no console é possível ver o seguinte erro:
Uncaught SyntaxError: Cannot use import statement outside a module (at script.js:1:1)
import axios from "axios";
const containerVideos = document.querySelector(".videos__container");
async function buscarEMostrarVideos() {
try {
const busca = await axios.get("http://localhost:3000/videos");
const videos = busca.data;
videos.forEach((video) => {
if (video.categoria == "") {
throw new Error("Vídeo não tem categoria");
}
containerVideos.innerHTML += `
<li class="videos__item">
<iframe src="${video.url}" title="${video.titulo}" frameborder="0" allowfullscreen></iframe>
<div class="descricao-video">
<img class="img-canal" src="${video.imagem} alt="Logo do Canal">
<h3 class="titulo-video">${video.titulo}</h3>
<p class="titulo-canal">${video.descricao}</p>
<p class="categoria" hidden>${video.categoria}</p>
</div>
</li>
`;
});
} catch (error) {
containerVideos.innerHTML = `<p> Houve um erro ao carregar os vídeos: ${error}</p>`;
}
}