How to change the template system from Jade to HTML with Express

This quick post is just to remember how to change the template engine on Express from Jade to HTML.

  1. Install the ejs view engine with the NPM:
    npm install ejs
  2. Set your template engine in app.js (or in your custom .js app file) as ejs
    app.engine('html', require('ejs').renderFile);
    app.set('view engine', 'html');
  3. In the route file ./routes/index.js  assign template variables like this
    exports.index = function(req, res){
    res.render('index', { title: 'Page title' });};
  4. Create the HTML files in the view folder /views.