Questions tagged [express-graphql]

GraphQL HTTP Server Middleware

Create a GraphQL HTTP server with any HTTP web framework that supports connect styled middleware, including Connect itself, Express and Restify.

310 questions
44
votes
7 answers

graphqlHTTP is not a function

Here is my simple graphql express app const express = require('express'); const graphqlHTTP = require('express-graphql'); const app = express(); app.use( '/graphql', graphqlHTTP({ graphiql: true, }) ); app.listen(4000, () => { …
Sachin Titus
  • 968
  • 1
  • 8
  • 20
35
votes
1 answer

GraphQL: Non-nullable array/list

I'm learning GraphQL now and while walking through tutorial I met behavior that I can't understand. Let's say we have defined type in schema: type Link { id: ID! url: String! description: String! postedBy: User votes: [Vote!]! } Due to…
DefLee
  • 355
  • 1
  • 3
  • 6
16
votes
7 answers

createReadStream() throwing RangeError: Maximum call stack size exceeded when uploading file

I am trying to use Apollo Server's Upload scalar to send files to S3 directly. My schema: const { gql } = require('apollo-server-express') module.exports = gql` extend type Mutation { createPicture( name: String! picture: Upload! ):…
W. Reyna
  • 594
  • 5
  • 19
11
votes
1 answer

How to remove the `__typename` field from the graphql response which fails the mutations

I tried changing the addTypeName: false in the Apollo client in GraphQL apollo.create({ link: httpLinkWithErrorHandling, cache: new InMemoryCache({ addTypename: false }), defaultOptions: { watchQuery: { fetchPolicy: 'network-only', …
Rigin Oommen
  • 1,530
  • 1
  • 15
  • 24
11
votes
1 answer

Apollo 2.0.0 Graphql cookie session

Can someone help me on this, My setup was as follows prior to Apollo 2.0, I had a server.js in which i used express and graphql-server-express I had a http only cookie session, when a user logs in I set the jwt token as a cookie and it is set in…
NUS
  • 323
  • 1
  • 6
  • 15
11
votes
1 answer

How to forward extension from one server to middleware server

I am using remote schema stitching on my middlware server. I am able to get the schema remotely on middleware server, defined my route like this on middleware server. app.use('/graphql', graphqlHTTP((request,res) => { const startTime = Date.now(); …
N Sharma
  • 28,073
  • 81
  • 228
  • 405
10
votes
3 answers

Where the data is Storing in Graphql

I started to use graphQl with react relay. And I followed some tutorials and I can able to get and post with the help of mutations and queries. Everything works fine but my question here is, Where qraphql is saving the data and fetching that for…
10
votes
2 answers

GraphQL: Query.type field type must be Output Type but got: undefined

I'm trying my first GraphQL approach. Here is the code: schema.js: import { GraphQLSchema, GraphQLObjectType, GraphQLInputObjectType, GraphQLNonNull, GraphQLString, GraphQLBoolean, GraphQLInt, GraphQLID, …
Mendes
  • 13,757
  • 24
  • 122
  • 217
9
votes
2 answers

ApolloServer.applyMiddleware({ express }) getting UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'use of undefined

const { ApolloServer, gql } = require('apollo-server-express') const express = require("express"); const next = require("next"); const dev = process.env.NODE_ENV === "development"; const app = next({ dev }); const handle =…
9
votes
1 answer

How to implement isTypeOf method?

Given this schema: interface INode { id: ID } type Todo implements INode { id: ID title: String! } type Query { node(id: ID!): INode } Given this class: export default class Todo { constructor (public id: string, public title: string) {…
Saulo
  • 349
  • 2
  • 12
8
votes
6 answers

Unexpected while using graphql

Getting EOF error every time at same line, changed code many times and even degraded to previous versions of graphql but no positive results. My code is: const graphql = require('graphql') const _ = require('lodash') const { …
Ansh Gujral
  • 171
  • 1
  • 1
  • 11
7
votes
0 answers

How to have cache to express-graphql?

In my nodejs application I use graphql with express-graphql. I can't see any cache option that library provide. How should I do the cache for graphql requests? (I need to support get and post)
Jon Sud
  • 5,117
  • 3
  • 28
  • 63
7
votes
1 answer

How to return an array of objects in GraphQL, possibly using the same endpoint as the one that returns a single object?

I am making a GraphQL API where I would be able to retrieve a car object by its id or retrieve all the cars when no parameter is provided. Using the code below, I am successfully able to retrieve a single car object by supplying id as a…
Haris Ghauri
  • 457
  • 1
  • 6
  • 22
7
votes
1 answer

Resolving nested data in express GraphQL

I am currently trying to resolve a simple recipe list that has a reference to ingredients. The data layout looks like this: type Ingredient { name: String! amount: Int! unit: Unit! recipe: Recipe } type Recipe { id: Int! name: String! …
areiser
  • 455
  • 1
  • 4
  • 15
7
votes
1 answer

Making a graphQL mutation from my python code, getting error

I am trying to make a mutation to my Shopify store from python. I am new to graphQL, I have been able to make the mutation using graphiQL but I am not certain how to do it directly from my code. This is my make query file, it has worked successfully…
1
2 3
20 21