标签:engines let 创建 hello fun set nbsp dex ESS
$ npm install pug --save
app.set(‘views‘, ‘./views‘)
app.set(‘view engine‘, ‘pug‘)
//Create a Pug template file named index.pug in the views directory, with the following content: html head title= title body h1= message
const express = require(‘express‘) let app = express() app.set(‘views‘, ‘./views‘) app.set(‘view engine‘, ‘pug‘) app.get(‘/‘, function (req, res) { res.render(‘index‘, {title: ‘Hey‘, message: ‘Hello there!‘}) }) app.listen(80)
Using template engines with Express
标签:engines let 创建 hello fun set nbsp dex ESS
原文地址:https://www.cnblogs.com/stefzi/p/11291814.html