Skip to content

how to insert a youtube iframe in a Node JS project? [closed]

I’m doing a project with Node Js and I know very little. I would like to insert a YouTube iframe in my project. What is the best way to do this?

Answer

You should create an html page like your_page_name.html with the iframe inside:

<iframe width="1280" height="763" src="https://www.youtube.com/embed/e4usrD1Xfw0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

and then in you main js file call the html page in this way:

app.get('/', function() {
  res.render('you_page_name.html', response);
});