Nodejs等待Localhost…获取数据

Nodejs waiting for Localhost..... and fetching data

本文关键字:获取 数据 Localhost 等待 Nodejs      更新时间:2023-09-26

我不知道这是一个反应路由器问题,我有或嵌套路由问题,甚至是一个数据问题。我一起黑客同构单页应用反应通量和节点/表达我难以理解为什么有时我/报告和/报告/:id路线会吐出任何数据或空数组如果我周期通过很多途径(如之间来回移动/报告和每个不同/报告/:id最终其中之一会吐未定义(任何随机的那一刻),当我回到我的仪表板,然后所有空数据(/报告)。如果我点击刷新,它会说等待localhost。永远(像1分钟+这是永远在网络上),然后我不得不重新启动服务器。

我的路由是这样的:

<Route>
 <Route name ="dash" path="/dashboard" handler={App}>
    <Route name ="dashboard" path="/dashboard" handler={Dashboard}/>

    <Route name ="assignReport" path="/user" handler={AssignReport}/>
    <Route name ="assignReported" path="/user/:id" handler={AssignReported}/>
    <Route name ="employees" path="/employees" handler={Employees}/>
    <Route name ="reports" path="/reports" handler={Report}/>
      <Route name ="singlereports" path="/reports/:id" handler={ReportView}/>
      <Route name ="addsubreport" path="/reports/:id/addsubreport" handler={AddSubreport}/>
      <Route name ="editreports" path="/reports/:id/edit" handler={EditReport}/>
      <Route name ="MyEmployees" path="/MEmployees" handler={MyEmployees}/>
      <Route name ="AllEmployees" path="/AEmployees" handler={AllEmployees}/>
      <Route name ="Profile" path="/profile" handler={Profile}/>
      <Route name ="reportstocomplete" path="/reportsc" handler={ReportsToComplete}/>
    <Route name ="addReport" path="/addReport" handler={AddReports}/>
    <Route name ="readme" path="/readme" handler={Readme}/>
    <Route name ="statistics" path="/statistics" handler={Stats}/>
    <Route name ="signup" path="/signup" handler={Signup} />
    <Route name ="login" path="/" handler={Login} />
    <Route name ="newreport" path="/newreport" handler={NewReport}/>
    <Route name ="templatereport" path="/templatereport" handler={TemplateReport}/>
 </Route>
</Route>

编辑:我意识到这可能不是路由问题,但很可能是ajax问题。我可能加载异步数据太慢了。我通过用户名(而不是id)搜索每个文档。任何想法吗?

编辑:它甚至可能不是ajax问题,问题不会发生在IE上,我可以刷新和获取数据一遍又一遍,但它有麻烦POST数据在IE上。在chrome上,它会说等待本地主机…一段时间。

编辑:我可以在firefox上发送垃圾邮件,并且一直都能正常工作。当我在浏览器中输入localhost:3000时,它不能正常工作,因此输入IP允许它工作(127.0.0.1);对chrome做同样的事情,在一堆垃圾邮件(10 - 20路由垃圾邮件(点击后退和前进/alt右和alt左)

后,我仍然得到未定义和卡在本地主机上

如果你使用嵌套路由,你应该把路由作为父路由。像

<Route name=parent handler={Report}>
  <Route name=child handler={ReportChild}/>
</Route>