Javascript 如何添加多个页面以使用ejs显示mongodb文档数组

Javascript 如何添加多个页面以使用ejs显示mongodb文档数组,javascript,node.js,mongoose,ejs,blogs,Javascript,Node.js,Mongoose,Ejs,Blogs,我正在制作一个基本的博客应用程序(我是web开发的新手,所以我构建这个应用程序是为了学习,所以没有什么先进的东西),我已经按照如下方式设置了获取、发布路线(我现在只设置了“/电影”路线) 这正是我所期望的。我可以用下面的代码显示“/movies”路线中的所有帖子(包含所有必需的详细信息),它可以正常工作 <% movieposts.forEach(function(moviepost){ %> <div class="row" style=&q

我正在制作一个基本的博客应用程序(我是web开发的新手,所以我构建这个应用程序是为了学习,所以没有什么先进的东西),我已经按照如下方式设置了获取、发布路线(我现在只设置了“/电影”路线)

这正是我所期望的。我可以用下面的代码显示“/movies”路线中的所有帖子(包含所有必需的详细信息),它可以正常工作

  <%  movieposts.forEach(function(moviepost){ %>
    <div class="row" style="margin-top:40px;">
      <div class="col">
        <div class="card flex-md-row mb-4 box-shadow h-md-250">
          <div class="card-body d-flex flex-column align-items-start">
            <strong class="d-inline-block mb-2 text-primary">Movies</strong>
            <h3 class="mb-0">
              <a class="text-dark" href="#"><%= moviepost.title %></a>
            </h3>

            <p class="card-text mb-auto"><%= moviepost.content.substring(0, 200) %> ...</p>
            <a href="#" data-toggle="tooltip" data-placement="right" title="Continue reading the full article!" role="button" data-animation="true">Continue reading</a>
            <small class="mb-1 text-muted">Written by, <%= moviepost.author %> at <%= moviepost.time %></small>
          </div>
        </div>
      </div>
    </div>
    <div class="col"></div>
    <% }) %>

电影

作者:在
但是我希望这个页面只显示10篇文章,并根据所有文章的需要添加新的页面(以及导航到下一页的方式)。我如何才能做到这一点,任何帮助表示感谢

  <%  movieposts.forEach(function(moviepost){ %>
    <div class="row" style="margin-top:40px;">
      <div class="col">
        <div class="card flex-md-row mb-4 box-shadow h-md-250">
          <div class="card-body d-flex flex-column align-items-start">
            <strong class="d-inline-block mb-2 text-primary">Movies</strong>
            <h3 class="mb-0">
              <a class="text-dark" href="#"><%= moviepost.title %></a>
            </h3>

            <p class="card-text mb-auto"><%= moviepost.content.substring(0, 200) %> ...</p>
            <a href="#" data-toggle="tooltip" data-placement="right" title="Continue reading the full article!" role="button" data-animation="true">Continue reading</a>
            <small class="mb-1 text-muted">Written by, <%= moviepost.author %> at <%= moviepost.time %></small>
          </div>
        </div>
      </div>
    </div>
    <div class="col"></div>
    <% }) %>