The Node.js Update #Week 18 of 2019. 3 May

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.

Node.js version 12.1.0 (Current) Released

  • intl:
  • Update ICU to 64.2. This adds support for Japanese Era (Reiwa)
  • Fixes a bug in ICU that affected Node.js 12.0.0 in the case where new Date().toLocaleString() was called with a non-default locale
  • C++ API:
  • Added an overload EmitAsyncDestroy that can be used during garbage collection

Node.js v12 - New Features You Shouldn't Miss

Node.js v12 is out on schedule! It is going into LTS in October and will be maintained until 2022.

This is a deep-dive article on the changes from Node.js v12 we consider essential to highlight!

  • V8 updated to version 7.4
    • Async stack traces arrived
    • Faster async/await implementation
    • New JavaScript language features
    • Performance tweaks & improvements
    • Progress on Worker threads, N-API
  • Default HTTP parser switched to llhttp
  • New experimental “Diagnostic Reports” feature

Send Images and Other Media via WhatsApp Using Node.js

The Twilio API for WhatsApp allows you to not only send text-based messages to WhatsApp numbers but also send and receive media messages. This allows you to send images (JPG, JPEG, PNG), audio files and even PDFs up to 5MB.

In this video we’ll show you how to do this with Node.js.

// Set up Twilio client
const twilio = require("twilio");
const client = twilio(
    process.env.TWILIO_ACCOUNT_SID,
    process.env.TWILIO_AUTH_TOKEN
);

// Send a message
client.messages.create({
    from: 'whatsapp:+123123123123',
    to: 'whatsapp:' + process.env.RECIPIENT_PHONE_NUMBER,
    body: 'Ahoy from Twilio!',
    mediaUrl: 'https://i.redd.it/rq36kl1xjxr01.png'
}).then( () => {
    // Promise success
}).catch( () => {
    // Promise reject
});

Best Practices For Using TypeScript with Node.js

Opinionated and useful examples on when and how to best use TS with Node.js. Table of contents:

  • Installing TypeScript in Node.js
  • Configuration with tsconfig.json
  • Linter
  • ES6 Considerations
  • Code Editors
  • TypeScript Definition files
  • Global Type Definition Files
  • When and why to choose TypeScript over JavaScript

How to Write Node.Js Applications in Typescript

Ever since I first discovered TypeScript, I use it for all my JavaScript applications. There are just so many advantages to using TypeScript that you’re going to need a compelling argument to get me to write anything in Vanilla JavaScript.

In this article, I’m going to show you how to set up a simple development environment for writing a Node.js application in TypeScript.

Dockerize and orchestrate your fullstack MEAN app easily

In the era of cloud services on demand, you may ask : why bothering to dockerize your app while you can deploy your frontend on a static AWS S3 hosting, your backend on lambdas, your API on AWS API gateway and your database on RDS ? Simply because it’s worth knowing how easy it is to actually create a fullstack app and deploy it all on a single hosting using docker compose orchestration.

In this article, we will cover:

  • How to create and dockerize a MEAN app
  • How to orcherstrate all services using docker-compose

4 Solutions To Run Multiple Node.js or NPM Commands Simultaneously

Funny Story, NPM Doesn’t Provide an Immediately Obvious Way to Run Multiple Scripts at Once.

We’ve all been there — you open up an app for local development and you need to run your Express/Node.js backend server and your React UI server simultaneously, but in order to do so you have to open up two terminal (or more) windows, cd into two different package.json files via the command line and run two different start commands.

Today, I will share four ways to run multiple Node.js commands or NPM scripts at once.