====== 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 * https://developer.github.com/v4/explorer/ 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! } [[https://raw.githubusercontent.com/sogko/graphql-shorthand-notation-cheat-sheet/master/graphql-shorthand-notation-cheat-sheet.png]] ===== MOCK: TRUE -- Super useful ===== const server = new ApolloServer({ typeDefs, resolvers, mocks: true // TODO -- super handy }); ===== Documentation ===== """ Triple double-quote for the type. This is doc for the type """ type X { "Single double-quote for the field" field: ID! } ===== Interface and misc ===== returns the typename for the field __typename ...on type pet{ id name weight ...on Cat{ curious } ...on Stingray{ stingy } } ===== resolvers ===== resolvers are used to get data wherever it is ===== Maybe give some info on ApolloClient ===== Apollo dev tool (chrome + firefox addon) * shows schema + graphiql * displays cached data * root query How are you supposed to use subscriptions? should they return data or no?