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 🙏

© 2026 – Pkg Stats / Ryan Hefner

dn-middleware-faked

v0.3.1

Published

用于 mock 后端 api 的中间件

Downloads

8

Readme

Faked 中件间用一个用于 mock 后端 API 的中间件

特点

  • 支持 mock 静态数据或逻辑
  • 支持 fetch/jsonp/ajax
  • 支持 RESTFul api
  • 同时支特手写 mock 代码或通过 GUI 配置
  • 不依赖 WebServer 降低单测的成本

使用

dev:
  - name: faked
    port: 6002
  - name: webpack2

放到 webpack1/2 中间件前即可,port 选项可指定 GUI 端口,省略将自动选取可用端口

从 mock2easy 迁移到 faked

在 pipe 中添加 faked 中件间,同时移除 mock2easy 的配置,将设定 m2f 选项,如下:

dev:
  - name: faked
    port: 6002
    m2f: true
  - name: webpack2

在首次启动时,会自动进行数据迁移。

迁移注意事项

  • 如果接口本身存在配置错误,会被舍弃
  • 如果接口本身指定的 method 和实际请求不一致,会无法匹配(因 mock2easy 对 method 并没有真实的检查)
  • 部分 ng 工程在 xxx.html 中手动引入了 cdn 资源将无法匹配,请在引入 ng 之前引入 faked (https://unpkg.co/[email protected]/dist/faked.js)