import { Paginator, PaginatedResponse } from "paginator-v1";
// Initialize a new Paginator
const page = 1;
const query = YourMongoModel.find({});
const Paginator = new Paginator(query);
let paginated_response: PaginatedResponse = await Paginator.getPaginatedResponse(page);
// Returns
{
result: [
object,
...
];
hasNextPage: false;
hasPreviousPage: false;
}
joybaruah / paginator Goto Github PK
View Code? Open in Web Editor NEWnpm
Home Page: https://www.npmjs.com/package/paginator-v1