Commit e5cd8253 authored by nikogu's avatar nikogu

增加禁用 proxy 的 start

parent 5e0d8684
......@@ -8,8 +8,10 @@ import { getProfileAdvancedData } from './mock/profile';
import { getNotices } from './mock/notices';
import { format, delay } from 'roadhog-api-doc';
// 代码中会兼容本地 service mock 以及部署站点的静态数据
// 是否禁用代理
const noProxy = process.env.NO_PROXY === 'true';
// 代码中会兼容本地 service mock 以及部署站点的静态数据
const proxy = {
// 支持值为 Object 和 Array
'GET /api/currentUser': {
......@@ -79,4 +81,4 @@ const proxy = {
'GET /api/notices': getNotices,
};
export default delay(proxy, 1000);
export default noProxy ? {} : delay(proxy, 1000);
......@@ -4,6 +4,7 @@
"scripts": {
"precommit": "npm run lint",
"start": "roadhog server",
"start:no-proxy": "NO_PROXY=true roadhog server",
"build": "roadhog build",
"site": "roadhog-api-doc static",
"lint:style": "stylelint \"src/**/*.less\" --syntax less",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment