【发布时间】:2018-05-10 20:23:34
【问题描述】:
我在 package.json 中添加了"proxy": "http://localhost:3001",然后运行 npm run start 来启动客户端应用程序。
然后我用 axios 来做这个
axios.get('/')
.then(resp => {
console.log(resp)
this.setState({
name: resp.name
})
})
我打开网络选项卡,我看到它调用 http://localhost:3000 而不是代理,有什么线索吗?我有一个在 3001 上运行的快速服务器。
【问题讨论】:
-
你不能改用
fetch吗? -
@mersocarlin 我可以,但我想知道出了什么问题。
标签: node.js reactjs axios create-react-app