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

How to write graphql query wiith custom objects

The server side of graphql is with nodejs and express. This is the schema for graphql. It has one query which accepts DateT object having from and to dates. var schema = buildSchema(` type Query { courseWithDate( timeFilter:…
user1298426
  • 3,467
  • 15
  • 50
  • 96
1
vote
0 answers

Return promise from graphql-request

I'm using graphql-request to request the data return request('/graphql', flightDetailsQuery, variables).then(res => res); This returns the as __proto__: Object but I need the __proto__: Promise. Can I specify it in request?
unknown_boundaries
  • 1,482
  • 3
  • 25
  • 47
1
vote
1 answer

How can I save multiple rows in one mutation in graphql and mongodb?

Here I want to add multiple thoughts in one mutation query. How can I achieve this: mutation{ savethoughts(data: [{id:1,name:"a"},data: {id:2,name:"b"}]){ id } }
Santy
  • 11
  • 1
  • 4
1
vote
1 answer

Unknown arguments at Graphql.js

I run a simple graphql code using argument with express-graphql. But graphiql show error message "Unknown argument \"age\" on field \"persons\" of type \"Query\". This is my code. var express = require('express'); var graphqlHTTP =…
Jadyn
  • 13
  • 3
1
vote
1 answer

GraphQL merging data from multiple REST calls

I have been looking at some GraphQL implementations and what I understand is that GraphQL lets you traverse through the data in the form of a Graph. Which means you get a list of books which is a REST call. The books might have an Author Name. …
Pharaoh
  • 712
  • 1
  • 9
  • 33
1
vote
1 answer

Add graphql wrappers around REST API ?

Can somebody please explain me how to wrap existing REST API in graphql, and how it will improve the performance ? Any small working example would help a lot. Thanks in advance !!!
Abhii
  • 295
  • 2
  • 6
  • 18
1
vote
1 answer

upgrading to apollo-server-express 2.0.0 context missing

Before the upgrade we were having import express from 'express'; import { graphqlExpress, graphiqlExpress } from 'apollo-server-express'; const app = express(); app.use( '/graphql', bodyParser.json(), graphqlExpress(req => ({ schema, …
NUS
  • 383
  • 1
  • 6
  • 17
1
vote
1 answer

How to do dependency injection to express-graphql resolvers while keeping access to the request object?

I'm using express-graphql in my nodejs app. In order to get access to the database from the resolvers, I have created an object called ProjectHandler (which handles a table in the database called projects) and I'm injecting it to the resolvers by…
Tom Klino
  • 2,358
  • 5
  • 35
  • 60
1
vote
0 answers

How to create nested objects in GraphQL mutation?

In GraphQL, I have two types, Author and Quotes, as follow: type Author { id: Int! name: String! last_name: String! quotes: [Quote!]! } type Quote { id: Int! author: Author! quote: String! } In the…
CoderX
  • 942
  • 1
  • 10
  • 30
1
vote
0 answers

How to Forward GraphQL Multipart Request with GraphQL Express

All of my React client requests get routed to a Node/express server for server-side rendering and then onto a Python/Django app via the graphqlExpress function from apollo-server-express. The client uses apollo-upload-client for file uploads.…
lgants
  • 3,665
  • 3
  • 22
  • 33
1
vote
1 answer

GraphQL - vue-apollo package, not outputting query in the front end

I am still learning GraphQL, and in this project i am just trying to get some queries to show up in the front end. I am using the package, GitHub - Akryum/vue-apollo: Apollo/GraphQL integration for VueJS but have yet to get anything to show up. I…
Andrew Baisden
  • 161
  • 1
  • 4
  • 17
1
vote
1 answer

When querying for a GraphQL float, what does the second argument represent?

I am making the following query in GraphQL: { metal(silver_bid_usd_toz: 1) { silver_bid_usd_toz } } which returns { "data": { "metal": { "silver_bid_usd_toz": 16.45 } } } The JSON object returned by the API is flat: { …
reknirt
  • 2,237
  • 5
  • 29
  • 48
1
vote
1 answer

express-graphql: How to remove external "data" object layer.

I am replacing an existing REST endpoint with GraphQL. In our existing REST endpoint, we return a JSON array. [{ "id": "ABC" }, { "id": "123" }, { "id": "xyz" }, { "id": "789" } ] GraphQL seems to be wrapping the…
JTAN
  • 411
  • 2
  • 5
  • 15
1
vote
1 answer

How to define an object field in GraphQLObjectType?

So I'm trying to create a User collection in MongoDB and make queries to it using GraphQL and mongoose. I've created my user schema in the path 'pathToServer\server\models\user.js' and it looks like this: const mongoose = require('mongoose'); const…
1
vote
1 answer

FormData with graphql-request

I am using graphql-request for graphQL queries at my frontend part (react). Server side using express-graphql. I have some ideas to handle that on backend side (your suggestions will be appreciated too), but searching how to handle frontend part. Is…
Jack Hudzenko
  • 157
  • 3
  • 14