First taste of GraphQL
My first time meet GraphQL is about three years ago. My excellent colleague Vincent introduce GraphQL to me at the office.
But at that time. GraphQL was a brand new technology. There were no existing design guidelines or best practices to follow or even a community in Taiwan to discuss it.
And we must focus on building new features while the company is in the early stage (Yeah. only two engineers just Vincent and I ). So we decide to follow the RESTful way at last.
Last month, after I read the blogpost at Shopify eng Blog. And I found that Evil Martians write a very detailed article to introduce how to combine GrapshQL with Ruby on Rails.
I think it’s time to try it.
After a quick build the todo app with both original way and GraphQl way. I realize that the power of GraphQl like
- We can request all the data we need in one. (no more overfetching)
- It returns only the data we need.
- We only require one endpoint for all our requests.
- It was straightforward to add into your Rails App now!
But remember, there is no silver bullet. It’s essential to understand the pros and cons of the technology before making a decision.
Here’s the link to source code of my test-app on GitHub.