[Question]How make it work with Handlebars?
See original GitHub issueI made the code and it sending me an error `router.get(‘/’, function(req, res) { res.render(‘index’, { user: req.user }, { title: ‘Express’ }); });
router.get(‘/tos’, function(req, res) { res.render(‘tos’, { user: req.user }, { title: ‘Terms of Service’ }); });`
<img src='{{user.photos[2].value}}' alt="Avatar Image" /> <span>{{user.displayName}}</span>
Error `C:\Users\VladG\Desktop\Tutorials\Express Web\CSGOGamble\node_modules\express-handlebars\lib\utils.js:18 callback(reason); ^
TypeError: callback is not a function at Immediate.<anonymous> (C:\Users\VladG\Desktop\Tutorials\Express Web\CSGOGamble\node_modules\express-handlebars\lib\utils.js:18:13) at runCallback (timers.js:672:20) at tryOnImmediate (timers.js:645:5) at processImmediate [as _immediateCallback] (timers.js:617:5)`
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
You’re not using the correct syntax for
res.render()
. You should specify the template (which you’re doing correctly), then a single object for the properties you wish to pass to that template. You’re instead passing in 2 objects, and the second one is in the place of where an optional callback should go. Do something like this instead:I need to make a var named user or its inside passport already?