title: How to create a pagination in Express.Js?
body: <p>I'm creating an API that takes data from a 3rd party API as well, which does not have pagination. I would like to create a pagination of 10 elements per page for some endpoints, I tried some guides but I fail in creating the pagination.</p>
  <p>My code is the following:</p>
  <pre><code>const Policies = require(&quot;../services/policiesApi&quot;);
  
  exports.policies_list = (async (req, res, next) =&gt; {
      const policiesList = await Policies.getPolicies;
      console.log(policiesCount);
      res.send(await policiesList)
  });
  </code></pre>
  <p>As you can see, I extract the data from the 3rd party API in another file and I export it to the controller, where I export as well to the routes.</p>
  <p>The route file</p>
  <pre><code>const express = require('express');
  const router = express.Router();
  const app = express();
  
  // Controller modules
  const policies_controller = require(&quot;../controllers/policiesController&quot;);
  
   router.get('/policies', policies_controller.policies_list);
  
  //Exporting routers
  module.exports = router;
  </code></pre>
  <p>Inside the route and the controllers there are other endpoints, but they don't need to have pagination (as they are taking the info of an id, for example).
  I tried to use express-paginate and paginate-info but I can't make it work.
  I would really appreciate if you can help me with this.
  Thanks!</p>