
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@ecoding/base.mock
Advanced tools
local: 本地目录文件作为 mock数据
在项目根目录创建 .mockrc.js 文件 配置了 exclude ,如果匹配到过滤项,则不走mock数据
配置了 include ,如果匹配到包含项,则走mock数据
若同时配置 exclude include,则逻辑是先排除,再包含。若都为空,则全走mock数据
module.exports = {
// 排除需要mock的接口,该参数作用于dip模式和local模式
exclude : [
"/api/cxc",
"/api/text"
],
// 包含需要mock的接口,该参数作用于dip模式和local模式
include : [
"/api/sjj"
],
}
npm run start
// 会请求到 mock/get/api/cxc/data.json
axios.get('/api/cxc')
module.exports = {
exclude : [],
include : [],
}
npm run start
// 会请求到 dip 平台的对应仓库id下,名为 api__cxc schema模拟数据
axios.get('/api/cxc')
demo
module.exports = function(request, response, mockjs){
return {
code: 200,
message: "success",
body: {
id: '',
url: '',
email: '',
age: '',
chineseName: '',
englishName: '',
image: '',
date: '',
info: ''
}
}
}
用法可参考mockjs函数的使用。 mockjs
FAQs
### options说明
We found that @ecoding/base.mock demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.