浏览器中通过路由访问通过render渲染的jade页面,为什么显示的是html代码啊?
app.js代码:
app.set("view engine","jade");
app.set("views","./views");
app.use(bodyParser.urlencoded({extened:true}));
app.use(express.static(path.join(__dirname,"static")));
index.jade代码:
doctype
html
head
meta(charset="utf-8")
title index
link(href="main.css",rel="stylesheet")
body
h1 index
下面通过路由访问
app.route("/").get(function (req,res) {
res.render('index');
});
页面显示的是
<!DOCTYPE html><html><head><meta charset="utf-8"><title>index</title><link href="main.css" rel="stylesheet"></head><body><h1>index</h1></body></html>