Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

error: expected undefined to be a graphql schema.

/*
You're not passing in a schema to your configuration for the /graphql endpoint.
Property names are case-sensitive in javascript. Change this:
*/
app.use('/graphql',bodyParser.json(), graphqlExpress({
  Schema,
  context:{
    Story,
    User
  }
}))
// to this:

app.use('/graphql',bodyParser.json(), graphqlExpress({
  schema: Schema,
  context:{
    Story,
    User
  }
}))

// or make your variable lowercase and then do:

app.use('/graphql',bodyParser.json(), graphqlExpress({
  schema,
  context:{
    Story,
    User
  }
}))
 
PREVIOUS NEXT
Tagged: #expected #undefined #graphql
ADD COMMENT
Topic
Name
6+3 =