loading...

Why GraphQL is the Ideal API Language for Frontend Engineers

Jay A. Patel on October 25, 2019

Facebook unveiled GraphQL to the developer community in 2015. What was once an internal research project quickly became the hot new standard for A... [Read Full]
markdown guide
 

Can you talk about how to actually get data out of a MySQL or Postgres database?

No one ever talks about that part. Everyone just focuses on the Magic queries. Well, how do those queries map to my Postgres tables and relations?

 

That is the job of resolvers which are equivalent to route handlers in REST. They are different ways to specify them depending on your graphql server but the concept is the same: "return a value".

 

Besides hand writing all resolvers, you can also take a look at Hasura or Postgraphile if you want to skip writing basic resolvers.

 

Do you feel like graphql is better for complex projects and apis? Or would you start with it over REST for any project?

 

Have used GraphQL for my last two projects. If one designs their GraphQL server well, it is trivial to change query from the frontend as you change the shape of the data w/o taking on more work.

GraphQL excels at the 'R' part of 'CRUD'. For mutations, it's on par with REST. As such, it is probably best to incrementally adopt GraphQL for projects - so it's not a GraphQL vs. REST but maybe whatever works best.

code of conduct - report abuse