sequelize-paginate
Sequelize model plugin for add paginate method
Installation
npm i sequelize-paginate
Use
// model.jsconst sequelizePaginate = module { const MyModel = sequelize sequelizePaginate return MyModel} // controller.jsconst Op = dbsequelize// Default page = 1 and paginate = 25const docs pages total = await dbMyModel// Or with extra optionsconst options = attributes: 'id' 'name' page: 1 // Default 1 paginate: 25 // Default 25 order: 'name' 'DESC' where: name: Oplike: `%elliot%` const docs pages total = await dbMyModel
NOTE: If options include limit or offset are ignored.