pass data to pug from node js code example
Example: pass data ino pug nodejs
1) Use this first
app.set('views', __dirname + '/public/views');
app.set('view engine', 'pug');
2) Then pass this to first visit
app.get('/', function (req, res) {
res.render('index', { title: 'Hey', message: 'Hello there!'});
});
3) Then echo in template file "index.pug" in "/public/views"
html
head
title= title
body
h1= message