使用 fetch 方法从快速端点获取数据显示错误 React Redux

using fetch method to get data from express endpoint shows error React Redux

我在我的应用程序中使用 redux。当应用程序安装时,我试图通过使用操作获取所有项目

export default function getItems(){
return function (dispatch) {
    dispatch(getJobsRequest());
    return fetch('http://localhost:5000/items', {
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
            'Authentication': localStorage.getItem('token')
        }
    }).then(function(response){
        console.log(response)
        return response.json()
    }).then(function(response){
        console.log(response)
        dispatch(getJobsSuccess())
    }).catch(function(error){
        console.log('error')
    })  
}

}

但中间发生了一些奇怪的事情,我可以在控制台中看到响应对象。但它没有到达快递终点

`router.get('/items',function(req,res){
    console.log('im called')

})`

我想通了。回退处理存在问题,因为它是单页应用程序。

它正在为 public 文件 index.html 的 get 请求提供服务,所以我必须像下面这样处理它:

app.get('*', function(req,res){
if(req.accept('html')){res.sendFile(path.join(__dirname,''public))}
  next() })