我想知道是否有办法使用graphql在name属性上加入两个 rest API 。这些是我的回应
// products API
[
{
id: "0001",
name: "a name",
color: "black",
size: "L"
},
{
id: "0002",
name: "an other name",
color: "red",
size: "M"
}
]
// price API
[
{
id: "xyz1",
name: "a name",
price: 10
},
{
id: "xyz2",
name: "an other name",
price: 20
}
]
我想用graphql来组合它们,这样
// response from graphql
[
{
id: "0001",
name: "a name",
price: 10,
color: "black",
size: "L"
},
{
id: "0002",
name: "an other name",
price: 20,
color: "red",
size: "M"
}
]
graphql 是正确的工具吗?