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.

386 questions
8
votes
9 answers

Error: No "exports" main defined in graphql-upload/package.json

Have installed graphql-upload, do import { graphqlUploadExpress } from 'graphql-upload'; And getting this error: Error: No "exports" main defined in graphql-upload/package.json Dependencies: "graphql-upload": "^14.0.0", "graphql":…
kiskesis
  • 171
  • 1
  • 1
  • 9
8
votes
14 answers

Unable to install express-graphql

I'm trying to install express-graphql but getting this error. Please, help! npm install --save express-graphql npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: rest-api@1.0.0 npm ERR!…
Udit Yadav
  • 99
  • 1
  • 7
8
votes
3 answers

Intercept Apollo/graphql requests

we are using Apollo/Graphql in our application, and we are facing an issue. The application is developed in Angular 5, and NodeJS as backend with graphql server that will respond to the front end. To intercept Http request in angular, we implement…
ezay
  • 81
  • 1
  • 1
  • 5
7
votes
1 answer

Add schema directive for all the queries in GraphQL

Is there a way to add a schema directive by overriding one of the methods of SchemaDirectiveVisitor for all the queries and mutations? For example to check the authentication token in a directive. Would be nice to add it just once not for every…
cosmarc
  • 562
  • 3
  • 19
7
votes
2 answers

How to use GraphQLError for customize messaging?

I am trying to do customize messaging with GraphQLError. There are few use cases that I want to handle with GraphQL Error: when username and password did not match, I want to return customize the message that username and password did not…
Piyush Bansal
  • 1,635
  • 4
  • 16
  • 39
7
votes
1 answer

How to unit test express-graphql mutations?

I have an Express-GraphQL API with a query and a mutation which works in GraphiQL, unit tests of query works, but a unit test of mutation returns a 405 error. my GraphQL schema is as follows: type Subject { type: String } type Category { name:…
Josh Reuben
  • 289
  • 2
  • 8
6
votes
3 answers

My Apollo Server's Subscription doesn't works: Cannot read property 'headers' of undefined

I tried to used it with the context connection, and adding the subscription params into the Apollo Server but it doesn't work. Is my first time using Apollo Server Subscriptions and i don't know if the error is in the server configuration or in the…
6
votes
1 answer

Explanation for different implementations of resolver function in graphql

I've been reading through the graphQL docs and found that they've explained the implementation of the graphql server in 2 ways: one using graphql-yoga which is a fully featured graphql server and another one is using graphql, express-graphql and…
6
votes
2 answers

Get max and min value using GraphQL query

I have been working on a GraphQL and firing queries to get the JSON response into react app. But I need to fire a query which will return me the max and min value from the column. I have gone through the document of GraphQL but nowhere I found the…
Vishal Shetty
  • 1,618
  • 1
  • 27
  • 40
6
votes
2 answers

graphql role based authorization

I'm new to GraphQL and going to build a solution using GraphQL. Everything looks cool but just concerned on how to implement the role based authorization inside GraphQL server (I'm considering using GraphQL.js/ apollo server) I will have a users…
Yue Teng
  • 63
  • 1
  • 4
5
votes
2 answers

"Not allowed to request resource" in Safari and "Blocked loading mixed active content" in Firefox. Perfect functionality in Chrome

I am working on an app using a React frontend and Express backend, with GraphQL setup through Apollo (I am following and modifying tutorial https://www.youtube.com/playlist?list=PLN3n1USn4xlkdRlq3VZ1sT6SGW0-yajjL) I am currently attempting…
5
votes
2 answers

Why graphQLErrors are always empty in react components?

I want to show some errors that comes from graphql server to user. Have some component with callback that use some mutation onSave() => { this.props.mutate({ mutation: CHANGE_ORDER_MUTATION, variables: { ids, …
comalex3
  • 2,497
  • 4
  • 26
  • 47
5
votes
1 answer

How to throw multiple errors with express-graphql?

In an express-graphql app, I have a userLogin resolver like so: const userLogin = async ({ id, password }), context, info) => { if (!id) { throw new Error('No id provided.') } if (!password) { throw new Error('No password…
François Romain
  • 13,617
  • 17
  • 89
  • 123
5
votes
0 answers

Mount middleware after graphqlHTTP.Middleware

I have a question about express-graphql. I’m trying to get a middleware run after the GraphQL resolver. These were my first two attempts: app.use('/api', graphqlHTTP({ schema: graphqlSchema }) ); app.use((req, res, next) => { …
zagen
  • 51
  • 1
  • 5
5
votes
1 answer

Wrong order of GraphQL resolver arguments (root, args, context)

I'm wondering why my arguments seem to be switched around inside my GraphQL resolver. I'm using express-graphql. Example of one resolver: getLocalDrivers: async (parent, args, ctx) => { console.log(ctx); } I've written the argument names as…
Hylle
  • 1,087
  • 1
  • 14
  • 25
1
2
3
25 26