User Tools

Site Tools


code:graphql:confrence2020

This is an old revision of the document!


Notes

  • One endpoint `/graphql`
    • Query
    • Mutation
    • Subscription
  • Return type
    • Enums are useful
enum PhotoCategory {
  PORTRAIT
  ACTION
  TEST
}

Aliasing a query:

query {
  alias : totalPets(status:AVAILABLE)
}

Neat link

Handling multiple behaviours for a single endpoint

  • array of options, filters… handle on the server

Dont forget you can put two queries in one:

query{
  query1{...}
  query2{...}
}

graphql scalar type

  • Int
  • Float
  • String
  • Boolean
  • ID

Nullable vs non nullable

name: String!
description: String

Nullable list of nullable values

photos: [Photo]

non-Nullable list of nullable values

photos: [Photo]!

non-Nullable list of non-nullable values

photos: [Photo!]!

Mutations

  • ~should~ always return atleast something
type mutation{
  get(): Boolean!
}

Custom Scalar

Things that arent gonna be a custom scalar, it will probably be an custom ENUM

scalar DateTime

type Photo {
  created: DateTime!
  updated: DateTime!
}
code/graphql/confrence2020.1585590548.txt.gz · Last modified: by ltsover9000