【发布时间】:2018-09-07 23:29:32
【问题描述】:
我刚刚开始使用带有 apollo 客户端的 graphql,我已经设置了 graphql 服务器并且正在运行 localhost:4000,这是我的客户端
index.js
const client = new ApolloClient({
uri: "http://localhost:4000/graphql",
cache: new InMemoryCache()
});
blog.js
const GET_BLOG = gql`
{
post(id:"5ab2b46d941953bf614e2617") {
title
body
user {
name
email
}
}
}
<Query query={GET_BLOG}>...</Query>
我让一切正常,我的问题是我可以更改 graphql 端点 url 名称,所以我可以有 /graphql/post、/graphql/user 之类的东西,而不是 graphql,我在 graphql 服务器中有方案,但如果我打两个电话,它只会在网络选项卡中返回两个 /graphql
【问题讨论】:
标签: javascript reactjs graphql react-apollo