Tutorial by Examples

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 locati...
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>

Page 1 of 1