Understanding `super` in JavaScript

With the adoption of ES6/2015 by nearly all browsers (with one notable exception), developers have access to the new class keyword and its construct for creating objects. If you are familiar with prototypical inheritance in JavaScript, don't worry, that knowledge is still useful. Why? Because JavaScript "classes" are just syntactic sugar over the top of prototypes. In this post, I'll shed a little bit of light on the ability to access a parent class (prototype) from...

Implementing Key Authentication in Express Gateway

This article was first posted on the Lunch Badger blog. Check them out if you're working with APIs in Node.js!

You've probably used it before: key authentication. The basic idea is simple, to authenticate your app or client with a given service you send a key to identify (and authorize) yourself. This is not intended for individual users necessarily, but rather for systems talking to each other. (Just to be clear, for users authenticating themselves you might want...

Build a Distributed Caching Layer with Express for APIs and Microservices

This article was first posted on the Lunch Badger blog. Check them out if you're working with APIs in Node.js!

Separating your API code into microservices has far reaching benefits, but you probably already knew that, that's why you're here! So now that you've decided to shift to microservices you have some problems to solve. One of those is that splitting up your service areas can make it difficult to access much needed data at the correct time. If you'...

A (Re)Introduction to Express.js Routes

This article was first posted on the Lunch Badger blog. Check them out if you're working with APIs in Node.js!

If you've written anything in Node.js the chances are you've used Express and its routing system. In this article I'd like to (re)introduce you to the built-in Router that really is the core of Express itself. We'll talk about the basic idea of routing, but then dig into some more advanced concepts like pattern and regex routes and advanced URL...

Using Express Middleware to Transform Data

This article was first posted on the Lunch Badger blog. Check them out if you're working with APIs in Node.js!

Let's imagine a system where you have a few different microservices in your external facing API, each one able to operate independently. Good start! Now we want to allow requests into those microservices from multiple clients - not just our own website. One of the issues you might quickly run into in this scenario is that many clients will want data...