Javascript 编译ejs时获取括号
我的节点js文件Javascript 编译ejs时获取括号,javascript,node.js,mongodb,mongoose,ejs,Javascript,Node.js,Mongodb,Mongoose,Ejs,我的节点js文件 app.get("/", async(req, res) => { const shortUrls = await ShortUrl.find(); const url = await ShortUrl.find({ realEmail: email }); res.render("index", { shortUrls: shortUrls, url: url, userEmail:
app.get("/", async(req, res) => {
const shortUrls = await ShortUrl.find();
const url = await ShortUrl.find({
realEmail: email
});
res.render("index", {
shortUrls: shortUrls,
url: url,
userEmail: profile._json.email,
userName: profile.displayName,
id: profile.id,
async: true
});
});
我的代码如下:
<tbody>
<%url.forEach((shortUrl) => { %>
<tr>
<td>
<a href="<%= shortUrl.full %>">
<%= shortUrl.full %>
</a>
</td>
<td>
<a href="<%= shortUrl.short %>">localhost:3000/<%= shortUrl.short %></a>
</td>
<td>
<%= shortUrl.clicks %>
</td>
<td>
<%= shortUrl.GivenEmail %>
</tr>
<%})%>
</tbody>
{ %>
当我运行这个时,我在我的站点上得到了以下内容。
有人知道为什么会发生这种情况吗?请帮助。只要从
app.js
中删除async属性,它就会工作