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
2
votes
0 answers

Accessing GraphiQL over a JWT protected route in ExpressJS

So far I've always had one big painpoint with GraphQL. I'm very well aware that you can specify headerEditorEnabled when you setup express-graphql like this: graphiql: { headerEditorEnabled: true, }, However, that doesn't really help if you've…
Dac0d3r
  • 2,176
  • 6
  • 40
  • 76
2
votes
1 answer

GraphQL Subscriptions is null using Express-GraphQL and graphql-subscriptions

I am using TypeScript and have Server and Client application. Below is the server code. Server Code import express, { Express } from "express"; import { graphqlHTTP } from "express-graphql"; import { buildSchema } from "type-graphql"; import {…
Aqdas
  • 868
  • 4
  • 16
  • 57
2
votes
2 answers

How to achieve GraphQL Error Handling for Multiple Items?

I have been learning GraphQL and right now I am learning things related to Error Handling in GraphQL. I referred to this article for Error Handling in GraphQL. Now, from Article I understand that If I have a user query in GraphQL then I can make an…
2
votes
0 answers

apollo explorer say "isTrusted": true when i try use Subscription

guys, I have a problem when I want to use a Subscription I'm facing this issue I don't find a solution in any place, I'm a GQL user and i decide to use Subscription to make real-time website but I'm facing a a this issue , hare is code I'm trying…
2
votes
0 answers

Array of String Data Type In GraphQL

I'm just learning GraphQL, but I'm confused with GraphQL schema. I have a GraphQL schema which has a string array data type My GraphQL Schema like this: type GetRecommender { resourceId: Int! title: String description: String …
Kholid Saifulloh
  • 191
  • 1
  • 1
  • 5
2
votes
1 answer

Cannot return null for non-nullable field in mikro orm graphql

I am trying to make a Graphql server with Mikro-orm and having a problem. Here's my Product.ts entity; import { Entity, IdentifiedReference, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core' import {…
Pranta
  • 2,928
  • 7
  • 24
  • 37
2
votes
1 answer

Avoid Code Duplication with GraphQL Cursor based Pagination

I've been looking all over for an answer to this and I've been banging my head on the wall. I wrote a cursor based pagination example that works well with graphql and the thing is I thought I would do the same thing with authors, that I did with…
dbzx10299
  • 722
  • 2
  • 14
2
votes
2 answers

passing multiple arguments along with `GraphQLUpload` in type-graphql mutations

I'm implementing a mutation for uploading photo with type-graphql, and I also want to get another argument like and ID: @Mutation(() => GraphQLJSON) async userUploadPostPhoto( @Arg("photo", () => GraphQLUpload) photo: Upload, @Arg("id")…
Emad Baqeri
  • 2,333
  • 2
  • 14
  • 29
2
votes
2 answers

Unable to import SchemaDirectiveVisitor from apollo-server-express

const { SchemaDirectiveVisitor } = require('apollo-server-express'); class ReplaceDirective extends SchemaDirectiveVisitor { visitFieldDefinition(field) { const { replacement } = this.args; field.resolve = () => { return…
Vipul
  • 75
  • 4
2
votes
0 answers

How to disable multiple operations in a single graphql request

Graphql support multiple operations in a single request. It means an unbounded number of graphql queries can be submitted in a single HTTP request which will cause some security issue. Is there a way to only allow a single operation in a single…
2
votes
0 answers

Filter on sub-fields in graphql-js

I'm using graph-ql-js on a node server. I've written the following query and am trying to filter on a subfield, but haven't been able to find documentation to do this successfully. I'm wondering if it's possible to filter on a sub-field using…
AMP_035
  • 167
  • 1
  • 2
  • 13
2
votes
2 answers

Need Solution to integrate Node+Express+GraphQL+ApolloServer+ElasticSearch

I need to develop my backed application in NodeJS ExpressJS and GraphQL, and I am using the Apollo GraphQL server for this. Now I have to connect this GraphQL to ElasticSearch so that I can directly write the ElasticSearch Queries in Apollo…
2
votes
1 answer

Graphql create relations between two queries.Error cannot access before initialization

I have this code: const ProductType = new GraphQLObjectType({ name: 'Product', fields: { id: { type: GraphQLID }, name: { type: GraphQLString }, category: { type: CategoryType, resolve: async…
2
votes
0 answers

{"errors":[{"message":"Must provide query string."}]}

I want to upload image on by using graphql-upload package This is my scheme file const { GraphQLSchema, GraphQLObjectType, GraphQLBoolean } = require("graphql"); const { GraphQLUpload } = require("graphql-upload"); const schema = new…
Krisna
  • 2,854
  • 2
  • 24
  • 66
2
votes
1 answer

express graphql always sends 500 Internal server error for any thrown error from resolver

I am using express graphql in my node app . and it graphql always sends 500 Internal server error for any thrown error from resolver. Please suggest any solution so i will get proper response and status code
Sunny G
  • 191
  • 2
  • 9