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

xmocker-cli

v1.3.1

Published

a server to provide api data for fe

Downloads

7

Readme

Build Status

前端mock用工具

介绍

本工具是定制的mock服务工具,主要针对的是特殊API进行的设置。特色:

  • 定义API使用WEB页面操作

  • API添加不仅依赖于URL链接,而是支持从输入参数中判断所属的API名称

  • 使用nodejs和Koa的function进行条件判断,可针对不同的数据返回自定义的结果

  • 使用本地文件数据库nedb,整个环境仅依赖于nodejs环境

  • 提供文件服务器,可执行gulp类型的构建,并提供页面刷新及url展示接口

说明

相比于 rap 和 yapi 等服务器类型的 Mock 服务, 本仓库定位于工具服务, 由于使用了本地的数据库,其单个库最大数据读取为 256M,所以不适合大量的 API 存储。 相比于服务器类型,主要侧重于编辑的灵活和自由,去中心化,避免多人编辑相互影响的问题, 同时也造成了 api 数据过于离散,API 数据交换相对麻烦一些。配合 webpack 的 proxyTable,使用更为方便一些。

Install

   git clone https://github.com/wenlonghuo/xmocker-cli
   cd xmocker-cli
   npm link --production

npm i -g xmocker-cli

使用

打开网页 http://localhost:6001 即可访问 在网页中添加完成项目相关的信息后,可使用命令进行启动对应的项目 命令:mocker

  Usage: mocker [options] [command]


  Options:

    -V, --version  output the version number
    -h, --help     output usage information

  Commands:

    start <proj>    启动项目
    stop <proj>     停止项目
    restart <proj>  重启项目
    list            列出项目
    exit            退出项目
    free <port>     杀掉指定端口
    here            在当前目录启动服务器,更多参数请使用 mocker here -h查看
    help [cmd]      display help for [cmd]

代理转发: 在输出处理函数中填入

const url = `${this.origin}${this.originalUrl.replace(this.path, '/url/new')}`
return this.tool.axios.get(url).then(res => res.data)

schema 使用的是json-gate https://github.com/oferei/json-gate

修改的项目
  • json-gate: https://github.com/oferei/json-gate
  • koa-send: https://github.com/koajs/send