EJS语法错误,无法在MongoDb的浏览器中呈现logging

Index.ejs写成如下:

<% include ../views/partials/header %> <ul> <% todos.forEach(function(todo){ %> <li><%= todo.text %> - <%= todo.body %></li> <% }) %> </ul> <% include ../views/partials/footer %> 

我可以console.log数据库logging,但是我得到一个语法错误的EJS文件。

当我在控制台中运行节点app.js时,我在控制台中看到下面的内容。

 MongoDB connected Server runnng on port: 3000 [ { _id: 5986375b48422cf78471d7d6, text: 'My ToDo One', body: 'This is my first todo app' }, { _id: 5986379748422cf78471d7e8, text: 'My ToDo Two', body: 'This is my second todo' } ] SyntaxError: missing ) after argument list in /home/rizwan/Documents/projects/todoapp/views/index.ejs while compiling ejs If the above error is not helpful, you may want to try EJS-Lint: https://github.com/RyanZim/EJS-Lint at new Function (<anonymous>) at Template.compile (/home/rizwan/Documents/projects/todoapp/node_modules/ejs/lib/ejs.js:549:12) at Object.compile (/home/rizwan/Documents/projects/todoapp/node_modules/ejs/lib/ejs.js:358:16) at handleCache (/home/rizwan/Documents/projects/todoapp/node_modules/ejs/lib/ejs.js:201:18) at tryHandleCache (/home/rizwan/Documents/projects/todoapp/node_modules/ejs/lib/ejs.js:223:14) at View.exports.renderFile [as engine] (/home/rizwan/Documents/projects/todoapp/node_modules/ejs/lib/ejs.js:437:10) at View.render (/home/rizwan/Documents/projects/todoapp/node_modules/express/lib/view.js:128:8) at tryRender (/home/rizwan/Documents/projects/todoapp/node_modules/express/lib/application.js:640:10) at Function.render (/home/rizwan/Documents/projects/todoapp/node_modules/express/lib/application.js:592:3) at ServerResponse.render (/home/rizwan/Documents/projects/todoapp/node_modules/express/lib/response.js:971:7)