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
0
votes
1 answer

express-graphql - how can I pass res object to a custom function in context?

In my config, I have the following: - expressGraphQL((req, res) => ({ ..., context: { req, res, database, }, })) I would like to be able to pass res to a custom function in the context, like so: - expressGraphQL((req, res) => ({ ..., context:…
U4EA
  • 832
  • 1
  • 12
  • 27
0
votes
1 answer

Limit Depth on Recursive GraphQL Schema Query using graphql-sequelize resolver (Node.js, express-graphql)

I have 2 Models, User and Post. I want to be able to get User information when querying a post, and be able to get all of a User's posts when querying a user. they have an association as follows: User.hasMany(Post, { foreignKey: 'user', as:…
Jesse Sainz
  • 131
  • 1
  • 12
0
votes
0 answers

Hi! I'm getting a cyclic dependency error

I'm trying to use graphql + apollo + mongodb. But I keep getting this cyclic dependency error. I'm trying to make a react app a recipe app. Here's the error cyclic dependecy detected Here's my schema.js, resolvers.js and server.js Here' s my mongo…
0
votes
1 answer

Express-graphql "Cannot read property 'collection' of undefined" with mongodb while runing mutation & query

I am trying to query and a mutation in graph QL with express-graphql, node, and mongodb. For both the query and mutation I am getting "Cannot read property 'collection' of undefined". I go into the DB and there is a collection with documents in…
dgresh24
  • 77
  • 1
  • 9
0
votes
0 answers

How to send success response message using express-graphql?

im new to graphql and using express-graphql for my server. I have question on mutation part, how we can send sucsess message if some operation (lika changing password) is succeeded, here is my mutation fields for change password changePassword: { …
principiorum
  • 528
  • 7
  • 21
0
votes
1 answer

Query by 2 or more fields on GraphQL

Suppose if we want to query multiple fields on GraphQL, how to do that ? { book(id:"123",name:"book1") { id, name, authors{ id } } } Also, how to filter out subfield, like author based on name?? { …
Rajat Sharma
  • 121
  • 7
0
votes
1 answer

Why GraphQl says that I forgot send args for mutation

I have graphql schema which contains a couple of mutations and queries. I think validation of mutation should call only when I send mutation { ... } to graphql server but currently, the server says me that I did not send arguments for all declared…
Sergey Volkov
  • 871
  • 11
  • 17
0
votes
1 answer

GraphQL Prisma Client connect not working

I'm playing around with GraphQL by following the tutorial here https://www.howtographql.com/graphql-js/0-introduction/ However, I cannot get the nested object working, it always has null value Below are snapshot of the mutation and the schema Link…
Ryan_Chau
  • 233
  • 2
  • 19
0
votes
1 answer

GraphQL query response coming back a null object instead of an array of objects

I read through and followed Why does a GraphQL query return null?, but I'm still getting an object of null fields where I should be getting an array of objects. This is my resolver. My tests pass if I'm looking up a single _id. If there is no _id I…
Gabriel Kunkel
  • 2,643
  • 5
  • 25
  • 47
0
votes
2 answers

RelayObservable: Unhandled Error TypeError: Cannot read property 'subscribe' of undefined in React and Relay

I have followed the subscription tutorial on How to GraphQL React + Relay (https://relay.dev/docs/en/subscriptions) but still not working. I'm using Relay Modern in my app and have successfully integrated query but not working the…
Raghav Rangani
  • 843
  • 7
  • 23
0
votes
1 answer

Destroy image from cloudinary

when I delete the image from my graphql server and using uploader.upload.destroy(public_id), it deletes from media library of cloudinary (https://cloudinary.com/console/media_library/folders/%2F) but image is still available If I access it via…
0
votes
2 answers

Limit GraphQL Queries by Breadth

There are a number of articles, tutorials and even modules that can limit malicious recursive queries by inspecting the query depth, cost or rate-limit a GraphQL server from a high rate of consecutive requests (DoS attack). However, I haven't been…
0
votes
2 answers

How to send the result of graphql query as a file?

I am implementing a graphQL server using Apollo server. I want to send the response of the queries as a text file instead of JSON response. Can anyone help me how to do it in Apollo server.I am using NodeJS for server implementation.
0
votes
0 answers

Connecting individual microservices exposed via graphQL to an application gateway aggregation layer

Taking into consideration the microservices architecture, let's say that we have two microservices which are exposing graphQL at localhost:4000/graphql localhost:4001/graphql Now I need to write one application gateway layer in nodeJS , say…
0
votes
0 answers

how to insert data in database using graphql from reactjs?

I am trying to save data in db using graphql but i am getting below error. Error { "errors": [ { "message": "Syntax Error: Expected Name, found String \"action\"", "locations": [ { "line": 4, "column":…
Sangram Badi
  • 4,054
  • 9
  • 45
  • 78