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

How to return list of files in directory using GraphQL query?

I need a list of files in folder, returned with GraphQL query. Can someone explain, how to configure the type and resolver the list? I have some configuration with fs() method, but it doesn't return the list of files. There's a code of schema and…
Kiten
  • 985
  • 2
  • 17
  • 35
0
votes
0 answers

Requesting for a list of post in graphQL gives error in Node js

I'm watching a tutorial and coding exactly as the instructor. I get this error at a point in the lesson. I get this error in my browser : The below code is not mine, credits goes to maximilian schwarzmüller (Instructor). Front End React function…
SPS
  • 733
  • 1
  • 8
  • 16
0
votes
0 answers

GraphQL resolver for certain field not being invoked

I wrote simple GraphQL schemas and resolvers in studying purpose, and I could not get reason why my codes work as expected. I used Prisma for ORM, and express-graphql and graphql-import to compose the API. type User { id: ID! name:…
cadenzah
  • 928
  • 3
  • 10
  • 23
0
votes
0 answers

GraphQL + Sequalize + existing database - "message": "parent.getPages is not a function" for one model not the other

GraphQL Query Morning all, I have a nice setup GraphQL -> Sequalize -> Existing DB (generated by a Laravel application). I've built this schema out: type App { id: ID! userId: ID user: User pages: [Page] experiments:…
Ben
  • 4,301
  • 6
  • 37
  • 61
0
votes
0 answers

Must provide query string in graphql

I am doing sample programs with node, graphql i done basic code to return some events my code is const express = require('express'); const bodyParser = require('body-parser'); const graphqlHttp = require('express-graphql'); const { buildSchema } =…
SaranViji
  • 383
  • 2
  • 6
  • 17
0
votes
0 answers

GraphQL and MongoDB - "Cast to Array failed" With Array

I'm trying to update a document in the "Inventories" collection. I'm passing the id of the inventory and the newItems that should be saved as the new inventory. When I try to run a test, such as: mutation{ …
av0000
  • 1,917
  • 6
  • 31
  • 51
0
votes
1 answer

zeit-now v2 + apollo-server-express: playground error: Server cannot be reached

Currently I am trying to get an api for my nextjs project to work. For deployment I am using zeit's NOW v2 (locally via "now dev"). Everything works fine except the graphql-server. In playground and via client I get an 404-error. Queries are getting…
Kian
  • 695
  • 2
  • 11
  • 23
0
votes
0 answers

GraphQL mutation returning null

I am using the mongdb database with graphql. But, graphql mutation createUser is returning null { "data": { "createUser": null } } here is my mutation resolver code: createUser: async args => { try { const existingUser =…
0
votes
1 answer

Express GraphQL TTFB is extremely long

I have a very simple setup. Express-GraphQL API with MongoDB database. MongoDB responses are in general quite fast but when I would like to return from GrapQL API, TTFB is taking too long especially for multi-user queries. For example, when I…
btutal
  • 115
  • 2
  • 7
0
votes
1 answer

Handle graphql schema stitching error in child query

I am new to graphql and want to understand the concept here. I have this graphql schema (stitched using graphic-tools). Not all cars have registration. So if I query for 5 cars and one car doesn’t have a registration (no id to link between cars and…
aiiwa
  • 591
  • 7
  • 27
0
votes
1 answer

GraphQL mutation that accepts an multiple level of array of object in one request

I need to be able to create a product and add it's levelwithskills (An array of objects which contains level name and array of skills) in a single request. I have this schema: input LevelData { name: String! skills: [SkillsData]! } input…
Nikhil Shrestha
  • 1,210
  • 1
  • 11
  • 18
0
votes
1 answer

GraphQL type 'Object'?

I have a MongoDB mongoose schema like this: const playerSchema = Schema({ conditions: { type : Object }, date: String }) With a collection like this: { _id: 5cee935cb56d5f794b452d78, conditions: …
kurtko
  • 1,978
  • 4
  • 30
  • 47
0
votes
3 answers

How to set a server name or host name globally and use it in any file?

I am working in graphql using node js. I want to get the hostname of a server and use it in anywhere of file. here is my code: app.use('/api',graphqlHTTP((req,res)=>({ context:{ oauth_token:req.oauth_token, host :…
Upasana
  • 45
  • 9
0
votes
1 answer

should I use express-graphql or appolo-server-graphql

I'm working on an express backend that use graphql ajd I don't know if I need to use the express-graphql or appolo-server-graphql lib. Thank you for your help!
Michel Melhem
  • 551
  • 1
  • 8
  • 22
0
votes
1 answer

GraphQLError Schema validation while triggering a mutation

I am trying my hand at GraphQL and I seem to have run into a strange error. Here is my mutation const createNewTask = { name: "AddATask", description: "A mutation using which you can add a task to the todo list", type:…
Giridhar Karnik
  • 2,213
  • 4
  • 27
  • 47