Node.js

mongo-monitor - a simple CLI to monitor your MongoDB cluster

The mongo-monitor CLI is a lean and simple tool to check the status of a MongoDB server or cluster. The code is on GitHub: github.com/dwmkerr/mongo-monitor Here’s how it looks in action: In this animation I am monitoring a simple sharded cluster, and running some example maintenance operations, adding a node to a replicaset, stepping down a primary and shutting down a replicaset node. A simple CLI which shows the status in real-time can be very useful to keep open when performing admin, letting you see how your changes affect the cluster as you work on it.
Read more

A utility to help you wait for ports to open

There are occasions where you might need to have scripts or commands which wait for TCP/IP ports to open before you continue. I’ve come across this need again and again when working with microservices, to make my life easier I’ve created a little utility called wait-port which will wait for a port to open: It’s built in Node, the project is open source, open for contributions and ready to use:
Read more

Using Slack for Server Development

I recently found a surprisingly helpful approach for server-side development which uses Slack in a creative way. The Problem The scenario can be roughly simplified to this: We are building a mobile app and application server. This will take data from a user, transform it and then pass it to the enterprise system processing. The problem is that the enterprise system doesn’t exist yet! Now this is not too much of a challenge, the first thing we did was build a simple mock of the enterprise system in Node.
Read more

Effective Node.js Debugging

If you are interested in improving your Node.js debugging skills, then check out my talk at the recent JSChannel 2016 conference in Bangalore: Comments and observations are always welcome!

Testing the Docker for Mac Beta

I’ve finally had a chance to install the new Docker for Mac Beta and give it a whirl. In this article I’m going to talk a bit about how Docker works, the challenges of running Docker on a Mac or Windows and how the new Beta helps. Below: The welcome message for the new Docker for Mac app So What is Docker for Mac? If you don’t know what Docker is, check out my article Learn Docker by Building a Microservice or the lovely What is Docker page from the docs.
Read more

Learn Docker by building a Microservice

If you are looking to get your hands dirty and learn all about Docker, then look no further! In this article I’m going to show you how Docker works, what all the fuss is about, and how Docker can help with a basic development task - building a microservice. We’ll use a simple Node.js service with a MySQL backend as an example, going from code running locally to containers running a microservice and database.
Read more

Manipulating JSON Web Tokens (JWTs)

I’ve been writing a couple of web services lately that use Auth0 for identity management. It’s a great platform that makes working with different identity providers a breeze. One thing that I couldn’t work out how to do at first was to quickly build a new JWT1 from an existing token. I wanted to take my current token, add some more data to it and return it to the user. So here’s a ‘why’ and ‘how’.
Read more

Blogging with Ghost

tl;dr Ghost is a blogging platform well worth considering if your blog is all about development. I’ve been having some gripes with WordPress as a platform for blogging lately. For development focused blogs like this one, there are some things about it that make writing posts just a little bit clunky. For example: Syntax Higlightling is always going to use plugins with various shortcode formats. This works, but your raw blog text becomes quite specific to a certain implementation.
Read more

Node.js and Express - Strange Http Status Codes

In a Nutshell Sending a response in Express with a call like res.send(status, body) will send body as the status code if it is numeric - ignoring status. This is due to a fudge for backwards compatibility. The Details As part of a project I'm working on, I'm writing a service using node.jsand Express. This service exposes some entities in a MongoDB database through a REST API. Typically I hit this API through client-side Javascript, but in some places I want to hit the same API from some C# code - and I don't want to have to create classes for everything.
Read more