
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
mock-http-api
Advanced tools
给 express 添加 mock 接口的功能
mock/http 文件夹下面的 mock 配置文件, 注册 mock 接口的路由并输出 mock 数据
.json 或者 .js 类型的 mock 配置文件/_apidoc 路由, 用于查看所有的 Mock 接口配置, 例如:
http://localhost:3000/_apidoc [查看所有 Mock 接口的配置]http://localhost:3000/_apidoc?map=1 [查看所有 Mock 文件与其 Mock 接口配置的映射关系]http://localhost:3000/_apidoc?path=user [从所有接口中找到匹配该路径的接口]具体请参考 example 文件夹
var express = require('express');
var mockHttpApi = require('mock-http-api');
var app = express();
// 给 express 添加 mock 接口的功能
// 会自动去读取项目根目录下 `mock/http` 文件夹中的 mock 配置文件
mockHttpApi(app);
app.listen(3000, function() {
console.log('Example app listening on port 3000!')
});
然后访问
http://localhost:3000/_apidoc 查看所有的 Mock 接口的配置
http://localhost:3000/api/news 查看具体的 Mock 接口
mock/http/api/news.js 定义了该 Mock 接口
http://localhost:3000/api/user 查看具体的 Mock 接口
mock/http/api/user.json 定义了该 Mock 接口
http://localhost:3000/users/ufologist 查看代理的 Mock 接口
mock/http/api/user.json 定义了该 Mock 接口
http://localhost:3000/github 查看通过代理实现 Mock 路由
mock/http/api/user.json 定义了该 Mock 接口
FAQs
给 express 添加 mock 接口的功能
We found that mock-http-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.