Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 获取数据的Prerender React页面_Node.js_Reactjs_Single Page Application_Prerender - Fatal编程技术网

Node.js 获取数据的Prerender React页面

Node.js 获取数据的Prerender React页面,node.js,reactjs,single-page-application,prerender,Node.js,Reactjs,Single Page Application,Prerender,我想在React应用程序中使用Prerenderer,为web爬虫提供静态HTML。 从文档中我了解到,我可以在localhost:8000上运行Prerenderer实例,在localhost:3000上运行我的应用程序。然后使用prerender节点中间件,我可以说:app.use(require('prerender-node').set('prerenderServiceUrl','http://localhost:8000')); 问题是:我在不同的端口上运行React和restapi

我想在React应用程序中使用
Prerenderer
,为web爬虫提供静态HTML。 从文档中我了解到,我可以在
localhost:8000
上运行
Prerenderer
实例,在
localhost:3000
上运行我的应用程序。然后使用
prerender节点
中间件,我可以说:
app.use(require('prerender-node').set('prerenderServiceUrl','http://localhost:8000'));

问题是:我在不同的端口上运行React和restapi。使用此设置,需要预呈现的URL不会到达REST服务器,因为它由React路由器使用

我试着从React路由器中注释出路由,它仍然给我
index.html
,其中包含React。尝试在
package.json
中设置代理以将未知请求路由到REST服务器,得到了相同的结果