#JavaScript #Node #Docker

Bring Redux to your queue logic: an Express setup with ES6 and bull queue

There always comes a point in a web application’s life where an operation is best served in the background, this is where queues come in. There are a few queuing solutions in Node. None of them are ridiculously dominant, eg. Kue, RSMQ, Bee Queue, bull. The issue with Kue, RSMQ and Bee Queue was its use of a done callback as the recommended API. Bull https://github.com/OptimalBits/bull is a premium Queue package for handling jobs and messages in NodeJS. ...

#JavaScript #Node

ES6 by example: a module/CLI to wait for Postgres in docker-compose

When using docker-compose, it’s good practice to make anything that relies on Postgres wait for it to be up before launching. This avoids connection issues inside the app. This post walks through how to deliver this functionality both as a CLI and a module that works both as a CommonJS module (require) and ES modules, without transpilation. “A fast, production ready, zero-dependency ES module loader for Node 6+!” is esm’s promise. ...

#JavaScript #Node #Testing

Testing an Express app with SuperTest, moxios and Jest

Testing is a crucial part of the software development process. It helps to catch bugs, avoid regressions and to document the behaviour of a piece of software. Express is one of the most widespread libraries for building backend applications in JavaScript. What follows is a summary of how to set up an efficient unit testing strategy for such an application as well as a couple of situations you may be faced with when attempting to test. ...

#JavaScript #Node #CLI

How to make beautiful, simple CLI apps with Node

Channel your inner Sindre Sohrus and ship a beautifully simple CLI app using Node. Command line apps are a neat way to package repetitive tasks. This will walk you through some tools that are useful to build CLI apps. The idea 💡 Piping to the command line 🚇 Dealing with sequential actions ✨ Executable JavaScript files 🦅 Adding package binaries 📦 Publishing to npm 🚀 The idea 💡 When merging/rebasing, the file that always seems to cause trouble is the package-lock. ...

#JavaScript #Node #Docker

Setting up Express and Redis with Docker compose

Redis and Express are tools that provide a simple and clean approach to their problem domains. The repo is available at: https://github.com/HugoDF/express-redis-docker. Redis is “an open source, in-memory data structure store, used as a database, cache and message broker”. It’s as simple and unopinionated as a database as it gets, it’s known for its performance and simplicity as a key-value store. It has great flexibility and can also be used as a message queue, circular buffer (and pretty much anything else a developer can come up with short of a relational database). ...

#VueJS #testing #JavaScript

From AngularJS to Vue.js, CommonJS and Jest

The trials and tribulations of kicking off an AngularJS -> Vue.js migration AngularJS was pretty groundbreaking. It’s still impressive to this day, packed with a router, an HTTP client, a dependency injection system and a bunch of other things I haven’t necessarily had the pleasure of dealing with. It also wraps most browser APIs as injectable services, that’s pretty cool. The downside is that it’s complicated: services, filters, injectors, directives, controllers, apps, components. ...