【发布时间】:2019-09-11 02:44:16
【问题描述】:
我有一个来自 REST API 服务器的 API 响应,我使用我的 REACT + Apollo 和 apollo-link-rest 调用它。但是 API 的响应看起来像这样
[
[
{
"name": "joe"
"address": "123 street hello city"
},
{
"name": "joe2"
"address": "1233 street2 hello2 city"
}
],
2356
]
如何使用这种响应创建一个查询,该查询具有一个数组,其中一个数字作为数组中的最后一项,并且数组的第一项由用户列表组成?
到目前为止,我只有这个查询。
const QueryTest = gql`
query people {
people @rest(type: "People", path: "/allpersons")
}
`;
【问题讨论】:
-
基于标签似乎你正在使用
Apollo,在这种情况下,数据源是apollographql.com/docs/apollo-server/features/data-sources的方式。
标签: reactjs rest graphql apollo