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

Context within express-graphql returns a function

I'm trying to create an authentication strategy using context within express-graphql, however, when I access context within isAuthenticated it returns [Function: context]. What am I not understanding? app.use( "/graphql", graphqlHTTP(async (req:…
bp123
  • 3,217
  • 8
  • 35
  • 74
0
votes
0 answers

GraphQL get all results for a collection

I am trying to get a list of all items in a collection with graphql, i am new to this and right now trying multiple things but nothing is working, below is what makes sense to me but as i said doesnt work to fetch all results in the collection, the…
Kravitz
  • 2,769
  • 6
  • 26
  • 53
0
votes
1 answer

Express GraphQL: I want to create a Team and populate with players, by passing the players IDs, but I can't find the correct syntax

Using Express-graphql, mongo/mongoose/ react. Im Creating a database with Teams, Players, and Matches. I want to write a mutation for creating a new team, which lists its players given their IDs, but I keep getting errors. I'm a newbie to GraphQL,…
cordovez
  • 71
  • 11
0
votes
1 answer

Graphql schema, add multiple custom objects in and and or

I am new to graphql, working on an existing schema. I've to add new filters into my existing API, but either my syntax is wrong or my query in postman is wrong. Essentially, I want to be able to query on both population and country Here's how my…
Pavanraotk
  • 1,097
  • 4
  • 15
  • 33
0
votes
0 answers

Should names of field in mongoDB model and graphql schema be the same to work?

In GraphQL should the names of fields in schema(typedef) and the names of fields in mongoDB model match for a getAll query resolver? eg :- product has a field "name" in schema and "title" in model definition. model for product :- const…
0
votes
1 answer

Make a user object property resolved inside @FieldResolver (posts)

I am creating a reddit clone, using a type-graphql, express-graphql and typegoose, first i run a query for posts and i get the user info (_id, username) : query posts { posts { _id title image body user { _id …
0
votes
1 answer

How to create an array in the GraphQL's argumment as GraphQL Code First Approach

In GraphQL Code First Approach I am trying to pass the same argumment for createUser in createManyUser but I want to pass it as an array to create many users at once. I searched a lot but couldn't find it in GraphQL Code First Approach. The…
0
votes
1 answer

Node JS - GraphQL - Elastic Search - Elasticsearch mapping does not contains info about is field plural or not

Elasticsearch mapping does not contains info about is field plural or not. So propName is singular and returns value or first value from array. propNameA is plural and returns array of values. I am sending an array of object but graphQL is not…
tycoon74
  • 1
  • 1
0
votes
0 answers

GraphQL query returns null data

My schema looks like this And my server setup looks like this When I perform a Query operation or Mutation Operation It works well, but when I perform a subscription operation, it shows that the data is null. Why is this happening?
0
votes
1 answer

Do not work .map() to mapping all data which I get from database in mongoose and express-graphql

I get all data in mongoose using .find() and try to mapping this data in express and express-graphql. So .find() work correctly and return all data but when I try to use .map() for mapping all data does not work for me with this error: Expected…
0
votes
1 answer

Sequelize/Apollo returns null on one to many relationship

I am working on a project with Express/ApolloServer/Sequelize/Postgres. I have two tables, one containing Sheep and the other containing Breeds. Breeds table is just an id and breed_name column. Every Sheep row has a Breed id as a foreign key. When…
Nika Bo
  • 63
  • 1
  • 11
0
votes
0 answers

Heroku doesn't update graphql schema once redeployed

I am new to Heroku, MongoDb, Graphql and the development. I created an app, deployed it to Heroku, everything was working just fine until I changed my schema (added 3 new fields). I used git push heroku main, heroku restart, and nothing seem to…
0
votes
1 answer

GraphQL schema formats

I'm learning graphQl and I saw that there are multiple formats to write schemas. There is the "JavaScript" format: const rootQuery = new GraphQLObjectType({ name:"root", description:"root of the resources", fields: () => ({ user:…
shamgar
  • 120
  • 9
0
votes
0 answers

GraphQL HTTP: "Cannot return null for non-nullable field Mutation.register."

I am trying to mutate in GraphQL to create a new user but I get the error of Cannot return null for non-nullable field Mutation.register. Screenshot of operation, variable and response here. graphql/schema/schema.js const{ buildSchema } =…
giovanni
  • 1
  • 3
0
votes
1 answer

Can't get CORS working with Restify + GraphQL setup

I've set up a GraphQL server using express-graphql and Restify, which works perfectly on Postman. However, when actually calling it from our frontend we keep getting CORS issues. I've tried just about everything. The weird thing is that if we remove…
Jul
  • 375
  • 5
  • 18