Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用Charles实现本地数据模拟 #8

Open
253867843 opened this issue Mar 15, 2019 · 0 comments
Open

使用Charles实现本地数据模拟 #8

253867843 opened this issue Mar 15, 2019 · 0 comments
Assignees
Labels
mock 数据模拟

Comments

@253867843
Copy link
Owner

253867843 commented Mar 15, 2019

Charles配置

1.项目使用端口号: 3000
mock-0
2.代码中发起请求axios.get('/api/blackboardlist'), 实际使用端口号
3.在package.json配置{"proxy":"localhost:5000"}, 将请求从
localhost:3000/api/blackboardlist
代理为
localhost:5000/api/blackboardlist
向5000端口发出数据请求
mock-1
4.Charles的"Proxy Settings"中配置"HTTP Proxy"的Port端口号为5000,
并勾选"Enable transparent HTTP proxying"
mock-2
5."Tools" >>> "Map Local Settings" >>> "Add"添加映射 >>> 在Host中输入
localhost:5000/api/blackboardlist
"Map To" >>> Local path >>> 在本地选择要映射的文件, 并勾选Case-sensitive
"OK" >>> "OK"
mock-3
6. 完成


1.在写json时, 不要输入多余的","逗号.

正确 >>> [{"href": "/联系我们", "text": "联系我们"}] >>> [Object Array]
错误 >>> [{"href": "/联系我们", "text": "联系我们"},] >>> 不能识别类型, [Object Undefined]

@253867843 253867843 added the mock 数据模拟 label Mar 15, 2019
@253867843 253867843 self-assigned this Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mock 数据模拟
Projects
None yet
Development

No branches or pull requests

1 participant