Я видел разные способы использования схемы и резолюров в GraphQL с ExpressJS. Какой из них мне использовать, а какой из них рекомендуется?
1:
`const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: "HelloWorld",
fields: () =>({
message: {
type: GraphQLString,
resolve: () => "Hello World"
}
})
})
})`
2:
`const schema = buildSchema(`
type RootQuery{
message: String!
}
Query {
query: RootQuery
}
`);`
`const resolver = {
message: () => "Hello World"
}`
< /code>
Я использую этот путь при определении схемы и резолюров. < /p>
`const schema = buildSchema(`
type RootQuery{
message: String!
}
Query {
query: RootQuery
}
`);`
`const resolver = {
message: () => "Hello World"
}`
Подробнее здесь: https://stackoverflow.com/questions/793 ... in-graphql