服务器没有返回JSON从Express到React(代理)

我正在尝试制作一个具有React前端(在端口8080上运行)和一个Express-Node.js后端(在端口3000上)的应用程序。 我希望我的客户使用fetch从我的服务器请求数据。 到目前为止,我在线阅读的内容表明,我需要使用http://localhost:3000的值向我的package.json添加一个proxy项。 我这样做了,我的服务器正确接收请求,但它的响应不是我所期望的(一个JSON对象)。 我究竟做错了什么?

 //Server app.get('/search', function(req, res) { ... //console.log(section) <-- Is the correct value res.json(section); }) ... app.listen(3000) //Client handleTouchTap() { fetch('/search?crn=10001').then(function(response) { //<-- Hard-coded for testing return response; //<-- Does not contain the value of "section" from server }).then(function(data) { console.log(data); //<-- Likewise, does not contain the value }); } //From package.json ... "proxy": "http://localhost:3000", ... 

你需要从你的回应中拉出JSON :

 fetch('/search?crn=10001') .then(response => response.json()) .then(section => console.log(section));