Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sequelize pagination postgres

const limit = 10;
const offset = (req.body.page - 1) * limit;

const result = await Posts.findAndCountAll({
  offset: offset,
  limit: limit,
  order: [
    ['date', 'ASC']
  ]
});
 
PREVIOUS NEXT
Tagged: #sequelize #pagination #postgres
ADD COMMENT
Topic
Name
3+2 =