I have data that I am able to log to the console but can't figure out how to make it available to my view.
The following works to console.log req.user upon signing in to an admin page
app.use(function(req, res, next){
console.log(req.user);
next();
});
The entire JSON object is passed into the console. I'd like to be able to pass it into my view but can't seem to make the following logic work. I'm either not passing it into the route correctly or not pulling it out into ejs correctly.
app.get('/', function(req, res) {
res.render('index.ejs',{
bootstrappedUser: req.user
});
});
What version of express are you using?, I dont see error in your code , but maybe in config files.Are you setting app.set('view engine','ejs')?,maybe your index.ejs file is not in the correct folder so you need to move it to /views in the root folder of your application.