You can do it this way:
-
Install ejs:
npm install ejs -
Set your template engine in app.js as ejs
// app.js app.engine('html', require('ejs').renderFile); app.set('view engine', 'html'); -
Now in your route file you can assign template variables
// ./routes/index.js exports.index = function(req, res){ res.render('index', { title: 'ejs' });}; -
Then you can create your html view in /views directory.