Reactjs 在客户端使用不同服务器的GraphQL查询

Reactjs 在客户端使用不同服务器的GraphQL查询,reactjs,express,graphql,create-react-app,react-apollo,Reactjs,Express,Graphql,Create React App,React Apollo,我有一个createreact应用服务器,它将所有API请求代理到位于localhost:3001的后端expressgraphql服务器 每当我在主页组件“/”上发出请求时,它都会将请求发送到“localhost:3000/graphql”,这很好。但是如果我在嵌套的子组件上发出请求,该子组件会将请求发送到 "localhost:3000/topic/:id" 它发回404,因为它找不到“” 因此,我的问题是,如何告诉React仍然向localhost:3000/graphql发出嵌套子组件

我有一个createreact应用服务器,它将所有API请求代理到位于localhost:3001的后端expressgraphql服务器

每当我在主页组件“/”上发出请求时,它都会将请求发送到“localhost:3000/graphql”,这很好。但是如果我在嵌套的子组件上发出请求,该子组件会将请求发送到

"localhost:3000/topic/:id"
它发回404,因为它找不到“”


因此,我的问题是,如何告诉React仍然向localhost:3000/graphql发出嵌套子组件的请求?

对于React apollo,在创建新apollo客户端时,将uri设置为
/graphql

const client = new ApolloClient({
  networkInterface: createNetworkInterface({
    uri: "/graphql", // you might have missed the `/` at the beginning
  })
});

您可以发布设置路由的代码,以及请求的位置吗?非常感谢!是的,我在没有graphql前面的/的情况下设置了networkInterface。谢谢!