我正在尝试在同一服务器上设置 create-react-app和节点。理想情况下,我希望将其设置为
'/ app / **'-->返回react build包
(注意:这将包括create-react-app + react-router v4)
'/ api / **'→全部在节点服务器中处理
据我所知,在其中设置了以下内容:
在服务器中
但仅为所有路由提供client / build / index.html
Create-react-app:
通过端口3000提供服务
但是问题是无法从外部访问api(即在heroku appname.heorkuapp.com/api/hello上不返回json输出)。
我已经看了很多遍,但在这方面没有找到太多帮助。任何帮助深表感谢!