What is HTML?

HTML means Hypertext Markup Language is used to design web pages. HTML is not programming languages like C++, JAVA, or python. It just markup template structure and constructs DOM (Document Object Model) .


Extension is .html you can give file name as anyname.html .html is important.



What is EJS?

EJS means Embedded JavaScript. It is a template language or engine. It is used to generate HTML dynamically.



Relation between HTML and EJS:

Actually we define the html variable in the EJS engine and how and where to transfer data on the page . generate templates and make the login and generate final HTML pages.


It means we can make dynamic html pages using the EJS engine.



We define the HTML variable in the EJS engine and how and where to transfer data on the page. generate markup templates and make the login and generate final HTML pages.


//app.js 
// declare variable which will hold your data 
var ejsVariables = {        title : 'ejs header', name : "your name"}; 
//pass the data when calling to render .ejs file 
res.render('index', ejsVariables); 


index.ejs

[code]
<h1> <%= title %> </h1>
<h1> <%= name %> </h1>
[/code]


final generated html

<h1>ejs header</h1> 
<h1> your name</h1> 


Thanks, May this example will help you






Are you facing problems in understanding this article?
You can watch the video. Watch it now