I thought I'd tried that previously.
app.use(function (req, res, next) {
res.locals.currentTime = new Date();
next();
});
app.get('/', routes.index);
Then in routes.index I have:
exports.index = function (req, res) {
res.render('index');/*
I *did* have the following, which I thought was causing the problem.
res.render('index', { title: "Welcome" });*/
};
And in my view I simply have
=currentTime
But I still get the following reference error that currentTime is undefined:
currentTime is not defined
at eval (eval at (.....\node_modules\jade\lib\jade.js:176:8))
at Object.exports.compile (.....\node_modules\jade\lib\jade.js:181:12)
at ServerResponse.res._render (....\node_modules\express\lib\view.js:425:23)
at ServerResponse.res.render (....\node_modules\express\lib\view.js:318:17)
at exports.index (....\routes\index.js:7:9)
at callbacks (....\node_modules\express\lib\router\index.js:272:11)
at param (....\node_modules\express\lib\router\index.js:246:11)
at pass (....\node_modules\express\lib\router\index.js:253:5)
at Router._dispatch (....\node_modules\express\lib\router\index.js:280:5)
at Object.middleware [as handle] (....\node_modules\express\lib\router\index.js:45:10)
I appreciate the help.