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

swagger-mock-server-kit

v0.0.36

Published

this is module that create a mock server by swagger doc

Downloads

14

Readme

swagger-mock-server-kit

语言: 中文

安装:

项目依赖nodemon, 必须事先在全局安装nodemon 执行npm install swagger-mock-server-kit nodemon -g 或者 yarn global add swagger-mock-server-kit nodemon

使用:

  1. 进入任意目录, 输入swagger-mock-server-kit create [项目名] [-y]

  2. 拿到swagger文档(swagger.yaml/swagger.json), 把文档放到任意目录

  3. 配置config.js(在步骤1指定目录下config子目录内), 把docFilename指向你上一步swagger文档放置位置

  4. 进入项目目录(步骤1指定), 执行npm start启动伪数据服务器

  5. 等待片刻, 伪数据服务器启动后你可以通过命令行提示地址访问到伪数据

特点:

  1. 自动通过swagger文档生成mock data

  2. 支持插件系统, 可以通过自定义插件去格式化你需要的mock data, 插件提供body对象, 可以很方便的操作swagger json对象

  3. 支持cors, 可以解析application/x-www-form-urlencoded, multipart/form-data, application/octet-stream, application/json格式请求

  4. 支持代理服务, 可以随时和后台真是接口数据对接

  5. 验证swagger文档, 对请求及响应通过sway验证(请求参数,响应体必须符合文档要求), 如果验证失败mock-server将不会返回mock data

  6. 整合swagger-ui, 方便查看文档

lanuage: english

install:

npm install swagger-mock-server-kit -g or yarn global add swagger-mock-server-kit

usage:

1.enter into any directory that you want to start this mock server and input "swagger-mock-server-kit create"

2.put your swagger specs file(eg: swagger.yaml or swagger.json) into any directory you want

3.editor config.js, make 'docFilename' equal to this swagger specs file path(step2 you do)[must]

4.enter directory that you choose at step 2 and execute "swagger-mock-server-kit start" or "npm start"

5.mock server will run and you will get mock data on this interface that aggre on before

features:

1.generate mock data by swagger specs file automately

2.plugin system, you can write plugin and generate formatimg mock data that you want, plugin is easy and useful

3.validate swagger api doc, request and response, if those is invalidate mock server will not return data

4.support cors, support parser application/x-www-form-urlencoded, multipart/form-data, application/octet-stream, application/json

5.support proxy, mock sever can communicate with real endpoint server

6.integrate swagger ui