PS Unscripted - purescript-graphql - A GraphQL.js wrapper
Channel: PureScript Community
Date: 2018-12-08

PS Unscripted, Dec 8, 2018

Writing a GraphQL server in PureScript using purescript-graphql.

https://github.com/hendrikniemann/purescript-graphql

# purescript-graphql

0:08 - Presentation intro
0:31 - Library overview
1:53 - Speaker intro
2:52 - GraphQL overview
3:26 - Q: Is relational database a graph?
5:13 - GraphQL's origins
5:45 - GraphQL is statically-typed
6:54 - Q: How do GraphQL types relate to PureScript ADTs?
7:54 - GraphQL type choices inclined towards helping prevent breaking your API

10:40 - Demo: hendrikniemann/purescript-graphql-example
12:42 - GraphQL language intro and server playground/explorer
23:05 - Q: What is the meaning of the exclamation mark in schema fields?

26:35 - Show how server responds to a query
27:28 - Schema definition in PureScript
27:56 - Queries and mutations
29:19 - Arguments to schema definition
29:59 - "post" object definition
31:22 - Q: GraphQL custom schema definition language?
32:25 - Show how to use `objectType` function
35:00 - Resolvers and query execution process
37:19 - Why PureScript is perfect language for type-safe GraphQL servers

41:08 - Comparisons of PureScript way with JavaScript way
44:05 - Resolver implementation in GraphQL.js and in Sangria-GraphQL (Scala implementation)
45:50 - PureScript design choice: records for schema definition

47:20 - Learning PureScript and RowToList excitement
48:22 - Comment: Could maybe build this API using functions and RowCons, see purescript-variant
51:21 - Look at "query" and its "args" to see how RowToList is used
1:00:03 - Sangria-GraphQL resolvers can return one of several data types
1:03:02 - Q: Why is concrete `Aff` used as the base monad in resolvers?

1:07:32 - Other cool projects in GraphQL ecosystem
1:07:42 - Hasura - GraphQL query to SQL query transformer
1:08:15 - n + 1 problem in GraphQL query resolvers
1:09:36 - facebook/dataloader - batching, caching, and deduping GraphQL queries
1:11:00 - Discussion of other ways to mitigate the n + 1 problem - gajus/postloader, facebook/Haxl

1:17:20 - Conclusion and post-talk chatter

Thank you @hendrikniemann for writing the purescript-graphql library, for learning PureScript to do so, and for taking the time to share his work and experience with us here!