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 🙏

© 2024 – Pkg Stats / Ryan Hefner

data-mock-server

v1.0.7

Published

mock data server

Downloads

1

Readme

GitHub license NPM version

data-mock-server - 接口模拟服务平台

配合 data-mock-send 使用效果更佳

功能特性

强大功能

  1. 自建数据模拟服务器 -- 一键搭建数据模拟接口服务平台
  2. 极速开发模拟 -- 直接curl或者使用postman发送post请求即可配置模拟请求
  3. 项目本地数据模拟 -- 搭配data-mock-send模块,一键配置本地数据模拟文件
  4. 临时调试模式 -- 提供云服务器可最直接在线调试

建议使用场景

  1. 本地开发调试中,将mock数据文件放到项目文件中配合data-mock-send模块,实现异步请求的模拟
  2. 本地开发调试中,将mock数据直接post到云服务器中进行配置模拟开发

如何使用?

  1. npm install data-mock-server
  2. 安装mongodb
  3. 配置config.js文件,如果服务端口号和数据库端口号没有占用的话,用默认的即可
  4. 启动服务
npm run start
  1. 配置mock数据,服务器地址后面需要加initdataformock,标识新增数据。使用postman等其他也可以

curl -XPOST -H "Content-type: application/json" -d '{  "name": "lujunhao", "age": 11 }' 'http://127.0.0.1:3000/e0ec6057dafaaadd0ca9fa87a73d5e64ba881891e7e3d2af3a7f1ae228e5410j/initdataformock/aa/bb'

  1. 获取mock数据,根据配置的url,会返回数据,支持get和post请求

curl -XPOST -H "Content-type: application/json" -d '{  "name": "lujunhao", "age": 11 }' 'http://127.0.0.1:3000/e0ec6057dafaaadd0ca9fa87a73d5e64ba881891e7e3d2af3a7f1ae228e5410j/aa/bb'

  1. 服务启动之后可参考demo https://github.com/jonhal/data-mock-demo

config文件配置

  1. serverPort -- 服务端口号 【默认即可】
  2. dataBaseUrl -- mongodb的服务器地址【默认即可】
  3. dataBaseName -- mock数据库名称 【默认即可】

我们还想做的

  1. 提供云服务端的数据模拟,不需要配置直接请求线上服务器
  2. 接口文档转换,根据文档格式自动配置mockmock数据
  3. 欢迎issue 或者发邮件[email protected]