Quantcast
Channel: How to define jade as a global variable in node.js Express? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How to define jade as a global variable in node.js Express?

$
0
0

Right now the following routing function works:

exports.summary = function(req, res, next) {   var jade = require('jade');  res.render('myView', {     main: jade.renderFile('./views/summary.jade')  });};

As you can see, the variable 'jade' is defined locally everytime the routing function is triggered. This can be a concern to performance. Whenever I tried to define jade globally, I received an error message saying jade is not defined.

Is there a way for me to define 'jade' globally?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images