
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
visualization-mock-server
Advanced tools
基于本地 mock 文件生成本地 mock 服务器
服务器基于express
└── mock
│ ├── empty.js
│ ├── login.js
│ └── products.js
login.js
export default {
"GET /function": (_req, res) => {
res.json({
success: true,
data: {},
errorCode: 0,
});
},
"GET /object": {
name: "zzz",
age: 21,
},
"GET /string": "string",
"GET /boolean": false,
"GET /number": 1,
"GET /array": [
{
name: "zzz",
age: 21,
},
{
name: "zzz2",
age: 22,
},
],
};
ObjectArrayFunction
express的req,res与nextStringNumberBooleanHTMLElement~~后续补上npm i visualization-mock-server -D
const initMockServer = require("visualization-mock-server");
initMockServer({ port: 4001, host: "localhost" });
const { devServerMiddleware } = require("visualization-mock-server");
const { onBeforeSetupMiddleware, before } = devServerMiddleware();
// webpack.config.js
module.exports = {
devServer: {
onBeforeSetupMiddleware: devServerMiddleware().onBeforeSetupMiddleware,
},
// 更早的devServer版本需要用before
devServer: {
before: devServerMiddleware().before,
},
};
针对不同的webpack-dev-server版本,考虑使用onBeforeSetupMiddleware与before
具体可查看devServer 暴露的 api 情况
express插件丰富 mock server 的用法
FAQs
基于本地mock文件生成本地mock服务器
We found that visualization-mock-server 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.