Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 编译ejs时获取括号_Javascript_Node.js_Mongodb_Mongoose_Ejs - Fatal编程技术网

Javascript 编译ejs时获取括号

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:

我的节点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: 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属性,它就会工作