HAML failing in Express code

226 views Asked by At

I am trying to run a nodejs app (Express and HAML View engine)

[email protected] , [email protected]

// To set view engine 
app.set('view engine', 'haml');

I am getting this error

TypeError: undefined is not a function at ServerResponse.res.render /node_modules/express/lib/view.js:323

This is the Express code snippet

// Attempt render
  try {
    var engine = view.templateEngine
       template = cacheTemplates
        ? cache[view.path] || (cache[view.path] = engine.compile(view.contents, options))
        : engine.compile(view.contents, options) ;
        str = template.call(options.scope, options); **This line is failing** 

    // layout expected
    if (layout) {
      options.isLayout = true;
      options.layout = false;
      options.body = str;
      this.render(layout, options, fn, view, true);

I am new to node.js

0

There are 0 answers