npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

pagination-api

v0.1.5

Published

Pagination for nodejs, support bootstrap and custom the css style, support mysql and mongodb.

Readme

pagination-api

Gitter [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [npm-image]: https://img.shields.io/npm/v/pagination-api.svg?style=flat [npm-url]: https://npmjs.org/package/pagination-api [downloads-image]: https://img.shields.io/npm/dm/pagination-api.svg?style=flat [downloads-url]: https://npmjs.org/package/pagination-api

example:

Definitions in routes:

var pagination = require('pagination-api');

Loading 'pagination' module

var total_rows;

'total_rows' return all article number . 'total_rows' is returns from the database

for example:
	total_rows = PostSorts_count_all_result[0].count_all_result;

var per_pages;

'per_pages' is the URL received the current page

for example:
	var per_pages = 1;
	if(req.query.per_page){
		per_pages = req.query.per_page;
	};
	if(req.body.per_page){
		per_pages = req.body.per_page;
	};

var per_page;

'per_page' is set the page displayed a few articles

for example:
	per_page = 4;

var base_url;

'base_url' is the definition of URL.

for example:
	base_url = 'blogs?';

var changePer_page;

'changePer_page' is parameters used to read database pagination

for example:
	changePer_page = ( per_pages - 1 ) * per_page;

var Create_links;

'Create_links' is create a page

for example:
	Create_links = pagination.create_links(total_rows,per_page,per_pages,base_url);

Last, sent to the views

for example:
	res.render('/',{Create_links:Create_links});

Definitions in views:

<%- Create_links %>

The examples in /test

#分页

示例:

定义routes:

var pagination = require('pagination-api');

加载分页模块

var total_rows;

'total_rows'返回所有的文章数量。'total_rows'是从数据库返回

示例:
	total_rows = PostSorts_count_all_result[0].count_all_result;

var per_pages;

'per_pages'是当前页面的URL接收的页码

示例:
	var per_pages = 1;
	if(req.query.per_page){
		per_pages = req.query.per_page;
	};
	if(req.body.per_page){
		per_pages = req.body.per_page;
	};

var per_page;

'per_page'设置页面上显示几篇文章

示例:
	per_page = 4;

var base_url;

'base_url'是URL的定义。

示例:
	base_url = 'blogs?';

var changePer_page;

'changeper_page'是用来读取数据库分页参数

示例:
	changePer_page = ( per_pages - 1 ) * per_page;

var Create_links;

'create_links'是创建一个网页

示例:
	Create_links = pagination.create_links(total_rows,per_page,per_pages,base_url);

最后发送到views中

示例:
	res.render('/',{Create_links:Create_links});

定义在views:

<%- Create_links %>

测试示例在 /test