第一步 下载art-template模板文件

npm i art-template
npm i express-art-template

第二部 利用中间件修改默认模板引擎为art-template

app.engine('html',require'express-art-template')

第三部 直接通过模板引擎渲染

app.render(模板文件名,动态数据(对象格式))

注意模板文件的默认位置为项目下的views文件夹,如果想修改可以通过以下代码来修改

app.set('views',新目录名)
Last modification:August 16, 2019
If you think my article is useful to you, please feel free to appreciate