
wveimar mamian
Preguntame sale error
node index.js
(node:6460) UnhandledPromiseRejectionWarning: Error: Expected undefined to be a GraphQL schema.
at assertSchema (/home/wveimar/Documentos/graphql/node_modules/graphql/type/schema.js:37:11)
at validateSchema (/home/wveimar/Documentos/graphql/node_modules/graphql/type/validate.js:34:28)
at graphqlImpl (/home/wveimar/Documentos/graphql/node_modules/graphql/graphql.js:60:64)
at /home/wveimar/Documentos/graphql/node_modules/graphql/graphql.js:23:43
at new Promise (<anonymous>)
at graphql (/home/wveimar/Documentos/graphql/node_modules/graphql/graphql.js:23:10)
at Object.<anonymous> (/home/wveimar/Documentos/graphql/index.js:13:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
(Use
node --trace-warnings ...
(node:6460) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(node:6460) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Diego Fernando Caviedes Camaho
Esto sucede porque debemos pasarselo como objecto
'use strict' const { graphql, buildSchema } = require('graphql') // definiendo el esquema const schema = buildSchema(` type Query { hello: String } `) graphql({ schema: schema, source: '{ hello }'}) .then((data) => { console.log(data) })