The pleasure of using GraphQL
By Aldert Vaandering
January 31, 2019
GraphQL is an incredibly powerful tool that comes with some responsibility. Because anyone can just customize their request it is relatively simple to rack up thousands of database queries in a single request, if you are not careful to throttle or otherwise manage the overhead.
On the other hand it means less requests to the server because theoretically the user only ever needs one call to receive all the revelant information they would need. This means deduplication and less bandwidth use.
I have been playing around with Node for a personal project, and whilst adding on feature after feature I started getting to the point where my backend was ready to start communicating with the front.
My progression so far:
- Started out with just Node
- React with Parcel and hot module reloading
- Node Express serving said app
- SQLite database
- TypeORM for interfacing with the database
- Apollo GraphQL server
Now what this allows me to do it directly interface with my database through TypeORM which in turn is being called upon by GraphQL. Using Apollo I can make use of caching, reducing the amount of times my database is being queried and ensure a speedy experience for my users. Combining this with a framework on the front end is a delightfully pleasant experience. No more chaining data requests. Just a easily editable GraphQL request that'll load in asynchronously.
The rabbit hole goes pretty deep, but my initial impression has been incredibly positive.
Amsterdam
The Netherlands
Arusan
KvK 84379057
1-201 taartskceeblaW