Optimizing GraphQL Queries with DataLoader

In my post about GraphQL and the Apollo server tools, I primarily focused on setting up a simple GraphQL schema and set of resolvers, but did not go much deeper. The main example in that post defined a findBy method which simulated hitting a database, but for the sake of brevity, this detail was largely overlooked.
Read more on Optimizing GraphQL Queries with DataLoader…

GraphQL + Apollo – Part 3: Building a Client

In case you are just tuning in, in this series, we have been taking a close look at GraphQL through the lens of the Apollo toolchain. Part 1 of the series explains some core concepts of GraphQL and introduces Apollo as a GraphQL solution. In Part 2, we took a closer look at building a GraphQL server with Apollo tools. Finally, in this post, we will take a look at the Apollo Client libraries and implement an example client to integrate with the example server from my previous post.
Read more on GraphQL + Apollo – Part 3: Building a Client…

GraphQL + Apollo – Part 2: Building a Server

In this series, we are taking a dive into GraphQL through the lens of the Apollo toolchain. Part 1 of the series explains some core concepts of GraphQL and introduces Apollo as a GraphQL solution. In this post, we will take a closer look at building a GraphQL server with Apollo tools. Part 3 will take a look at the Apollo Client libraries and implement an example client. Read more on GraphQL + Apollo – Part 2: Building a Server…

GraphQL + Apollo – Part 1: An Introduction

This past September, I attended the Strange Loop conference in St. Louis. Among the plethora of great talks that I attended was one about GraphQL, given by Lee Byron. This talk, supplemented by a great deal of research, convinced me that I should use GraphQL in the project that I started a couple of months ago.
Read more on GraphQL + Apollo – Part 1: An Introduction…

Timing Your Queries in Knex.js for Node.js

While developing web applications, I keep a close eye on performance issues, particularly in database queries. In my latest project, I’ve been using Knex.js, a SQL query builder for Node.js.

I developed a method of logging the queries executed by Knex.js as well as the execution times for each query. This method can be applied to nearly any application that uses Knex.js, and it uses a few features of Knex.js that I didn’t notice immediately, so I thought I’d share this small but useful bit of code.
Read more on Timing Your Queries in Knex.js for Node.js…

Higher-Order Components in React

React emphasizes composition over inheritance, making it simple to compose larger components by reusing smaller ones. This approach is at odds with the way many programmers are accustomed to reusing code: inheritance Object-Oriented Programming (OOP).

React uses higher-order components (HoCs) as an alternative to inheritance. Similar to higher-order functions, which take or return other functions, HoCs are functions that take a component as an argument and return another component. Read more on Higher-Order Components in React…