Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express const render [res.locals]

app.use(function(req, res, next){
    res.locals.items = "Value";
    next();
});
//your routes follow
app.use(‘/’, home);

// this is for render
res.render('layout', {title: 'My awesome title',view: 'home', item :res.locals.items });
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #express #const #render
ADD COMMENT
Topic
Name
2+3 =