Logo

dev-resources.site

for different kinds of informations.

New possibilities with GraphQL

Published at
12/12/2024
Categories
graphql
nosql
coding
github
Author
KateMLady
Categories
4 categories in total
graphql
open
nosql
open
coding
open
github
open
New possibilities with GraphQL

Nowadays, communities that support software run many blogs to explain the nuances of development. Here you go, GitHub GraphQL for beginners!

Image description

Some code inserts, examples and samples for installation will help at the beginning of the path. If there is a need for a question, you can always leave a comment under the post, I think the developers will not refuse to communicate.

Let's continue our exploration of GraphQL!

schema {
  query: MyQueryType
  mutation: MyMutationType
  subscription: MySubscriptionType
}

The diagram allows you to assemble a graph from the previously listed objects and even indicate specific connection points.

enum Episode {
  NEWHOPE
  EMPIRE
  JEDI
}

input ReviewInput {
  stars: Int!
  commentary: String
}

type Mutation{
  createReview(episode: Episode, review: ReviewInput!): Review
}

Adding/removing objects happens automatically without the need to understand graph theory (although I recommend it!). It looks like simple functions with a number of parameters.

function Query_person(obj, args, context) {
  return context.db.loadPersonByID(args.id).then(
    userData => new Person(userData)
  )
}

Queries about objects are also implemented through functions. The simplest knowledge of the theory of OOP classes will help to form a correct query to the DB.

It looks quite demanding, but I think that's a good thing! Let's not forget about good coding style. I consider the high entry threshold into NoSQL GraphQL to be a plus, since knowledge of scripting constructs/APIs requires a certain developer status.

Featured ones: