【发布时间】:2018-06-28 07:53:50
【问题描述】:
我正在使用 ejs,并且我有以下代码。
app.get('/profile/:name',function(req,res){
var data={
age: 29,
job:'ninja'
};
var ejsData={
data:data,
person:req.params.name
};
res.render('profile',ejsData);
});
使用以下ejs文件
<!doctype html>
<html>
<head>
<style>
body{background: skyblue;font-family: verdana;color: #fff;padding:
30px;}
h1{font-size: 48px;text-transform: uppercase;letter-spacing: 2px;text-
align: center;}
p{font-size: 16px}
</style>
</head>
<body>
<h1>Profile Page <%= ejsData.person %></h1>
<p>The Age of the Person is <%= ejsData.data.age %> </p>
<p>He works as a <%= ejsData.data.job %> </p>
</body>
</html>
但是我一直收到这个错误?我在做什么错?
【问题讨论】:
标签: javascript node.js compiler-errors ejs