Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
mock_service
Advanced tools
A mock API data service for frontend development.
提供一个UI后台用作前端开发的模拟前后端数据对接
使用流程大概是在前端项目运行一个代理服务, 代理指向API服务端口, 当有请求发来时, API服务自动把请求push到UI后台,
然后我们就可以在后台写一些测试数据发回给请求。
支持post/get等类型的请求
后台的功能包涵JSON数据录入, 自动返回数据, 能查看请求参数及其它请求信息, 筛选请求捕捉等。
后台我们录入的数据是存在本地的indexedDB。
##Demo 先打开 后台页面, 然后访问 API服务链接 就可以在后台页面看到访问的信息。
##依赖 需要有redis环境 MacOS上安装很简单, 以下命令:
brew install redis
运行:
redis-server
##使用 可选两种使用方式:
git clone https://github.com/nonjene/mock_service.git
然后安装依赖, 运行:
npm install --production
默认的后台端口是3000, 访问端口是3001。 (可在./config/config.json
修改)
运行API服务及后台:
npm run start
然后浏览器打开后台:http://localhost:3000
然后就可以测试是否可运行了:
访问: http://localhost:3001/some/api/request
查看后台页面,就会收到请求信息了。
然后可以在前端项目建一个80端口的服务代理到3001端口,就OK啦。详见./demo/index.js
安装中间件:
npm install mock_service
使用:
var mockService = require("mock_service");
app.use(mockService({
webSocketConfig: {port: 3336},
redisConfig: {port: 6379},
adminPort: 3000
}))
MIT
FAQs
A mock API data service for frontend development.
The npm package mock_service receives a total of 2 weekly downloads. As such, mock_service popularity was classified as not popular.
We found that mock_service 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.