From e5cd82531bf4ca6964d6686b2cbc529e6e727d90 Mon Sep 17 00:00:00 2001 From: nikogu <644506165@qq.com> Date: Thu, 14 Sep 2017 15:31:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A6=81=E7=94=A8=20proxy=20?= =?UTF-8?q?=E7=9A=84=20start?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .roadhogrc.mock.js | 6 ++++-- package.json | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.roadhogrc.mock.js b/.roadhogrc.mock.js index 89fdc8e4..3fabce2e 100644 --- a/.roadhogrc.mock.js +++ b/.roadhogrc.mock.js @@ -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); diff --git a/package.json b/package.json index 50a36493..6cd21c00 100755 --- a/package.json +++ b/package.json @@ -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", -- GitLab