The Node.js Update - #Week 7 - 15 February, 2019

Below you can find a collection of the most important Node.js updates, tutorials & announcements from this week - curated by RisingStack's Node.js Developers.

Concerns in the Node Community about Node.js 'koa-router' package transferred to unknown user

The koa-router package was just transferred to a relatively unknown user on GitHub and the package name was apparently sold.

You should version lock your koa-router package immediately!

What security guidance would be most useful for Node.js developers?

Currently the Guides section of the Node.js documentation does not have any documentation around security. Such a guidance would be a useful and welcome addition to the documentation.

"I would like to use this issue to solicit input both from the Security Working Group as well as from the broader Node.js community. An ideal outcome would be a list of security aspects to take into account when writing Node.js programs that we could turn into guides or a set of guides on the Node.js website." - wrote Marcin Hoppe

Node.js v11.10.0 Current Released

  • Updated libuv to 1.26.0.
  • Updated npm to 6.7.0.
  • response.writeHead now returns the response object.
  • Implemented a histogram based API.
  • Exposed process.features.inspector.
  • Added repl.setupHistory for programmatic repl.
  • Introduced client "session" event.

Processing large volumes of data safely and fast using Node.js and PostgreSQL

Gajus Kuizinas created a PostgreSQL client (Slonik) with an intent to reduce repeating code patterns, protect against SQL injections and enable better developer experience. In this post he presents that client and describes the reasoning behind the design choices.


Slonik has been battle-tested with large data volumes and queries ranging from simple CRUD operations to data-warehousing needs.

How to code your own event emitter in Node.js: a step-by-step guide

Event Emitters play a very important role in the Node.js ecosystem. The EventEmitter is a module that facilitates communication/interaction between objects in Node. EventEmitter is at the core of Node asynchronous event-driven architecture.


If you follow this tutorial, you will build:

  • EventEmitter class
  • on / addEventListener method
  • off / removeEventListener method
  • once method
  • emit method
  • rawListeners method
  • listenerCount method

Handling Asynchronous Operations in Parallel

Node.js, in a nutshell, is a single-threaded environment for JavaScript execution on the server side. JavaScript you write is executed on one single thread. How then Node.js handles load and keeps performance up? The key is non-blocking asynchronous I/O. To be honest, it is not that simple at all.

The article goes through ways to handle it.

Generating PDF from HTML with Node.js and Puppeteer

In this article Mate Boer shows how you can generate a PDF document from a heavily styled React page using Node.js, Puppeteer, headless Chrome & Docker.

Step up your game, start using Nest!

NestJS is a fully-featured open-source Node.js framework that enables us to create compelling and demanding backend systems. It is currently the fastest raising Node.js framework written in Typescript.

Nest enables us to write highly testable, scalable, loosely coupled, and easily maintainable applications. To do so, it uses express under the hood. It acts as another layer on top and makes a lot of things easier for us.

OpenAPI Directory: 1400 API specs, installable & searchable on npm

This repo builds & bundles the OpenAPI Directory, so you can easily find, require and use any OpenAPI spec from the directory in your JS projects.

It provides files that can be individually required or remotely downloaded (via for every API in the collection, and an index to quickly find the relevant OpenAPI spec for a given URL.

deploy-to-kube: Deploy your Node.js app to Kubernetes with a single command

Deploy your Node.js app to Kubernetes with a single command. No config required.

Supports any Kubernetes cluster, including the following:

  • Google Kubernetes Engine
  • Amazon EKS
  • DigitalOcean Kubernetes
  • KubeSail (completely free Kubernetes hosting)
  • Custom Clusters

node-service-tools: Prepare your Node.js application for production!

This library provides common functionalities, like graceful error handling & shutdown, structured JSON logging and several HTTP middleware to make your application truly ready for modern containerised environments, like Kubernetes.

fnm: Fast and Simple Node.js Version Manager

tl;dr: fnm is a very fast Node.js version manager, ~40x faster than NVM. It supports .nvmrc files and Fish shell out of the box. It works on Linux and Mac and distributed as a single executable - and it is open source on GitHub!