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
1
vote
0 answers

GraphQL functionality with plain JavaScript/JSON

I’m trying to understand what the advantages are of GraphQL. I’ve read about reducing the number of endpoints and the complexity of server responses, but it seems that the same results can be achieved with JS alone. Here’s an example of a data…
SuperCodeBrah
  • 2,874
  • 2
  • 19
  • 33
1
vote
0 answers

implementing directives in a graphql server

How can I implement a schema that supports something like this: http://graphql.org/learn/queries/#directives When I use $ before a parameter, I get a parsing error GraphQLError: Syntax Error: Expected Name, found…
1
vote
0 answers

Stitching schemas in graphql not being resolved and returning null?

I have recently started using apollo/graphql to develop an api for my project and mongodb as my backend database. I have followed this tutorial on the apollo website https://www.apollographql.com/docs/graphql-tools/schema-stitching.html to develop a…
Richi
  • 21
  • 5
1
vote
1 answer

graphql why do I need to declare a extra parameter within a resolvers parameter

I had been reading everywhere about graphql and was stuck in a misunderstand implementation in the resolvers function: This was my bad resolver, what I was getting was a undefined argument: const jobResolvers = { Query: { job(id) { …
Angel
  • 1,670
  • 1
  • 11
  • 14
1
vote
1 answer

Error handling with express-graphql & react-apollo

I'm trying to display a simple "Email and password do not match" error on a login form, but am having trouble and not sure if where I've gone wrong is on the server or in my React app. I thought I'd post here as I'm unsure which github repo would be…
Good Idea
  • 2,481
  • 3
  • 18
  • 25
1
vote
2 answers

Error in graphql in Express , node js

I'm trying to run graphql server in express. But it throws following error. var graphqlHTTP = require('express-graphql'); // express graphql var { buildSchema } = require('graphql'); // graphql var schema=buildSchema( type Query { …
user8765531
1
vote
1 answer

_id of an Object in a Record changes on updating the data of the same object

I have an array of objects. Each object saves the Activity Types. I need to update one of the objects of the array. I used the _id for updating or deleting the object. So, when I pass id to update the data, I actually find the index of that object…
Amanpreet
  • 219
  • 3
  • 10
1
vote
1 answer

babel-node vs node: graphql files with import/exports

It appears that NodeJS does not understand import/export commands in graphql files (extension .gql), but babel-node does. The only fix I can come up with is to rename the .gql files to .js files, but I lose syntax highlighting. Is there a simple…
Jeff Lowery
  • 2,492
  • 2
  • 32
  • 40
1
vote
1 answer

join 3 tables using graphql query

I want to join 3 tables just like we do in mysql based on primary and foreign keys. Can I do such using graphql(http://graphql.org/) My table structure along with graphql query is below. Thanks query($companyId:String){ Data{ reach{ …
Owais
  • 854
  • 2
  • 13
  • 32
1
vote
1 answer

NodeJs GraphQL dynamic query variable

https://launchpad.graphql.com/9qvqz3v5r Here is my graphQL example If i passed userId:2 as static { user(userId:2){ firstName lastName } } I will get output as below { "data": { "user": { "firstName": "Joe", …
1
vote
1 answer

Root Methods for GraphQL Sub Field Queries

I am new to GraphQL and am not sure how to implement queries on sub fields. For example, say we have the following types and queries: type Author { joinedDate: String, quote: String } type Post { id: String, author: Author, …
Mac
  • 1,143
  • 6
  • 21
  • 45
1
vote
1 answer

GraphqlJS Schema pattern

I walk through some tutorials of GraphQLJS that uses graphql-tools package, with makeExecutableSchema command, some others that use graphql package using a new GraphqlSchema (as object), other with the same graphql package but the command…
1
vote
1 answer

Accessing the request object with express-graphql

According to http://graphql.org/graphql-js/authentication-and-express-middleware/ To use middleware with a GraphQL resolver, just use the middleware like you would with a normal Express app. The request object is then available as the second…
Adam Rackis
  • 82,527
  • 56
  • 270
  • 393
0
votes
1 answer

make graphql mutation return multiple types

i'm working on creating mutations for a project i'm working on but stuck on the resolver returns, i won't to handle the errors while i'm at it as well by sending back messages for notifications to make it user friendly, but let's say my mutation is…
0
votes
1 answer

How to change Http Status code when getting error from GraphQL?

I want to change http status code when throw error like with "throw new Error("this is my error.")"? I want this because i should return localized error message in frontend. How can do this, is it possible? I tried this but i got the this…