一个预防测试代理环境。
- 命令方式
- 配置创建
npm i -g abtest
abtest init [--force]
# --force 强制
abtest serve <serveName> [--port=3000] [--signal=start|stop]
abtest link [serveName] [--port=3002]
# 连接到serveName服务
# 我们可以直接创建 `abtest.config.js` 来写入配置
我们在项目里创建 abtest.config.js
配置文件
module.exports = {
serve: "qxg-app",
name: "test1",
port: 3002,
};
这个例子是将创建一个代理连接到 qxg-app,name 是 test1 ,代理端口号是 8080
完成上面后,我们需要在前端的请求库设置 headers['x-abtest'] = 'test1'
来进行代理。
MIT