【发布时间】:2018-12-03 22:25:11
【问题描述】:
我已经构建了以下 Graphql 架构,但我无法弄清楚如何为一些假数据构建 JS 对象。有人可以帮我弄清楚我做错了什么吗?
// GraphQL schema
const schema = buildSchema(`
type Query {
apps: [App]
}
type App {
id: ID!
show: Show
name: String
url: String
author: String
price: Float
image: String
}
type Show {
id: ID!
name: String
airDate: String
users: [User]
}
type User {
id: ID
name: String
email: String
}
`);
这是我嘲笑的,但它不起作用
module.exports = {
apps: [
{
id: 1,
show: 1,
name: 'App 1',
url: 'http://google.com',
author: 'John',
price: '0.00',
image: 'http://img.vibethemes.com/VeryVibe-125x125.png'
},
{
id: 2,
show: 1,
name: 'App 2',
url: 'http://yahoo.com',
author: 'Bob',
price: '2.99',
image: 'http://img.vibethemes.com/VeryVibe-125x125.png'
}
],
shows: [
{
id: 1,
name: 'This is a cool show'
}
]
}
但这给了我一个错误。我想也许我在某处有错误的属性名称。感谢您的帮助
【问题讨论】:
标签: javascript graphql