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

femock

v0.1.9

Published

mock

Downloads

2

Readme

FEMock - 数据接口模拟平台
安装
nodejs & npm
  • nodejs 0.12.4

  • npm install femock

使用

  • pm2 start pm2.json 或者 node --harmony index.js

  • 默认端口 9503

  • 可以编辑nginx.conf,绑定域名;

    upstream femock.com {
        server  127.0.0.1:9507;
    }

    server {
        listen       80;
        server_name femock.com;
        root  /node/femock;
        index index.html index.shtml index.htm;
        location / {
            proxy_pass         http://femock.com; 
            proxy_set_header   Host             $host; 
            proxy_set_header   X-Real-IP        $remote_addr; 
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_set_header   Upgrade $http_upgrade;
            proxy_set_header   Connection "upgrade";
            proxy_http_version 1.1;
        }
    }
  • 提供数据模拟功能,按路径返查询数据,并根据设置的接口返回状态,返回相应的数据;

  • 添加接口: 支持3种请求方式,2种返回方式,接收参数为接口接收的必填字段,多个字段使用逗号分隔;

  • 同一业务线不允许有相同路径存在,唯一接口可以直接使用路径访问,重复路径请加 client : '*' 字段加以区分(*号为业务线值,小写字母,如:c)

  • 加入socket.io 推送处理情况, 按ip分组多点推送消息

未绑定域名:
$.ajax({
    url : 'http://127.0.0.1:9503/mock/test',
    data : {ac:1, ab:'b'},
    type : 'get',
    success : function(data){
        console.log(data)
    }
});

$.ajax({
    url : 'http://127.0.0.1:9503/mock/test',
    data : {ac:1, ab:'b',client:'b'},
    type : 'get',
    success : function(data){
        console.log(data)
    }
});
绑定域名:
$.ajax({
    url : 'http://femock.com/mock/test',
    data : {ac:1, ab:'b',client:'b'},
    type : 'get',
    success : function(data){
        console.log(data)
    }
});