install ejs using the following(I know it's obvious)
sudo npm install ejs --save
var express=require("express"); //express is included
var path=require("path"); //path is included
var app=express(); //app is an Express type of application
app.set("views",path.resolve(__dirname,"views")); //tells express about the location of the views in views folder
app.set("view engine","ejs"); //tells express that ejs template engine is used
the following is an ejs file.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello, world!</title>
</head>
<body>
<%= message %>
</body>
</html>
app.get("/",function(req,res){
response.render("index",{ //render the index when root(/) is requested
message:"rendered view with ejs"
});
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello, world!</title>
</head>
<body>
message:"rendered view with ejs"
</body>
</html>