【发布时间】:2021-02-23 17:41:40
【问题描述】:
这是服务器,我使用pug模板engine init
const express = require('express');
const app = express();
const path = require('path')
const port = 80;
//Express specific stuff
app.use('/static' , express.static('static')) //For serving static files
//Pug specific stuff
app.set('view engine', 'pug'); //set the template engine as pug
app.set('views' , path.join(__dirname , 'views')) //set the views directory
//End points
app.get('/' , (req , res)=>{
res.status(200).render('index.pug')
})
//start the server
app.listen(port , ()=>{
console.log(`The application is running at port${port}`)
})
我想知道的只是角色是什么
app.set('views' , path.join(__dirname , 'views'))
是否意味着将views文件夹连接到应用程序??
【问题讨论】: