📜  在 pug nodejs 中传递数据 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:30.045000             🧑  作者: Mango

代码示例1
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