I am quite new to Express.js/Node.js and trying to pass multiple values from a route to a view so that I am able to show user specific input on the page. This is what I have in my route:
// Dashboard for site after the login
app.get('/dashboard', function(req, res) {
res.render('dashboard.jade', {
title: 'Dashboard',
user: app.get('user_name')
});
});
I have stored the user name in app.get('user_name')
. If I replace it with a normal string like 'test string'
than it works. But if I use this app.get
function nothing is getting passed to the view.
Thanks
Try using app.locals documented here: http://expressjs.com/api.html#app.locals
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With