|
|
|
|
|
by jaequery
2974 days ago
|
|
i thought Graphql was confusing at first, merely because of their distinction of "Query" and "Mutation". It turns out (which I should've known), "Query" is just like GET requests where you are retrieving information and "Mutation" is like a POST/PUT/PATCH/DELETE requests that can modify the data. After grasping this, Graphql was pretty similar to working with REST and a bit more flexible in how we want the data to be returned. Graphql really does fix the whole "query multiple endpoints to construct a single data" dilemma. Only thing I didn't like about it was the way Graphql schema is to be written in server side, thought it could be a bit more intuitive and simplified . Currently, it can get pretty verbose and breaks the DRY mantra. Would be nice if the Type system can be hooked up with the whatever ORM you are on (Mongoose, AR, Sequel) because you'll be re-mapping the fields to Graphql which can be an overhead for no reason. Also schema is like working with SOAP's WSDL all over again. I used to hate it but it's back with Graphql so I'm trying hard to like it! |
|
One of the nicest things of GraphQL is the type system indeed. You can use tools like https://www.prisma.io/, which generates a GraphQL backend based on your SQL database.