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

umock

v2.3.0

Published

服务器端的Mock

Downloads

55

Readme

umock

服务器端的Mock Server

  • 综合配置众多后台服务的反向代理,集成不同的后台,前端任意调用不同的后台调试。
  • 通过解析swagger.json统一接口数据展示。
  • 对每个接口可以设定测试数据,随时完成API调试。
  • mock数据,开发前期协作利器。
  • 中间拦截,修改返回数据,前后端彻底分离开发。

安装

npm安装

npm install -g umock

git安装

下载

git clone https://github.com/vvpvvp/umock.git

参数

设置端口号

umock -p 9000

端口号默认为8000,-p命令优先级更大,其次文件配置

项目配置

使用umock.js文件进行配置。 如果执行的命令在当前目录下,默认识别umock.js文件,或者使用命令-f识别。

使用MySQL存储配置数据

执行

npm install mysql

在配置文件umock.js中

const config = {
	"mysql": {
		"connectionLimit" : 20,
		"host": "localhost",
		"user":"root",
		"password":"root",
		"database":"mock"
	}
};
module.exports = config;

数据库初始化,使用文件mock.sql

启动

//github本地安装,需要在根目录下添加umock.js
npm install
npm run start

//全局安装启动
umock -p 端口号 -f 配置文件

推荐安装nodemon,如果安装了nodemon,则执行:

npm run server

访问

http://localhost:端口号

Demo

配置

这里我们使用Swagger的官方demo进行配置:

详情

在详情页,可以查看该Swagger返回的接口说明,具体请访问 http://umock.ch-un.com/server/5

反向代理

umock本身就是一个数据mock的服务器,通过访问umock,添加author的Header,即可反向代理至任何后端。

在线版本

http://umock.ch-un.com

Dependencies: