const express = require('express');
const path = require('path');
const app = express();
app.engine('art', require('express-art-template'))
app.set('views', path.join(__dirname))
app.set('view engine', 'art');
app.locals.users = [{
name: 'zhangsan',
age: 20
}, {
name: 'geyao',
age: 20
}, ]
app.get('/index', (req, res) => {
res.render('index1', {
msg: 'message'
})
})
app.get('/list', (req, res) => {
res.render('list1', {
msg: 'list page'
})
})
app.listen(3000);
console.log('服务器启动成功');
index.art
{{msg}}
<ul>
{{each users}}
<li>
{{$}}
{{$value.age}}
</li>
{{/each}}
</ul>