Node.js Weekly Update - 18 August

Below you can find RisingStack's collection of the most important Node.js updates, projects & tutorials from this week:

Node v8.4.0 (Current) Released

Notable changes:

  • HTTP2:
  • Experimental support for the built-in http2 has been added via the --expose-http2 flag.
  • Inspector:
  • require() is available in the inspector console now.
  • Multiple contexts, as created by the vm module, are supported now.
  • N-API
  • New APIs for creating number values have been introduced. #14573
  • Stream
  • For Duplex streams, the high water mark option can now be set independently for the readable and the writable side.
  • Util
  • util.format now supports the %o and %O specifiers for printing objects.

Building an API Gateway using Node.js

Learn what are the benefits and best practices of API Gateways for microservices, and how you can start building yours using Node.js.

Node.js API Gateway at Netflix

Services in a microservices architecture share some common requirements regarding authentication and transportation when they need to be accessible by external clients. API Gateways provide a shared layer to handle differences between service protocols and fulfills the requirements of specific clients like desktop browsers, mobile devices, and legacy systems.

Node pdf-bot

A Node queue API for generating PDFs using headless Chrome. Comes with a CLI, S3 storage and webhooks for notifying subscribers about generated PDFs

Node.js PDF Bot

pdf-bot is installed on a server and will receive URLs to turn into PDFs through its API or CLI. pdf-bot will manage a queue of PDF jobs. Once a PDF job has run it will notify you using a webhook so you can fetch the API. pdf-bot supports storing PDFs on S3 out of the box. Failed PDF generations and Webhook pings will be retryed after a configurable decaying schedule.

ES Modules in Node Today!

This fast, small, zero dependency package is all you need to enable ES modules in Node 4+ today.

ES Modules in Node.js

I’m excited to announce the release of @std/esm (standard/esm), an opt-in, spec-compliant, ECMAScript (ES) module loader that enables a smooth transition between Node and ES module formats with near built-in performance!

Node.js Config Best-Practices

This article talks about the DOs and DON’Ts of Node config handling.

When building any kind of server side app, you will eventually have the following thoughts:

  • I would like to bind my app to a specific port.
  • I would like to enter a connection string so I can connect to my database.
  • I would like to use a third-party service through a provided API key or credentials.

Puppeteer - A Headless Chrome Node API

Puppeteer is a Node library which provides a high-level API to control headless Chrome over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome.

What can it do?

Most things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:

  • Generate screenshots and PDFs of pages.
  • Crawl a SPA and generate pre-rendered content (i.e. "SSR").
  • Scrape content from websites.
  • Automate form submission, UI testing, keyboard input, etc.
  • Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.
  • Capture a timeline trace of your site to help diagnose performance issues.

Async/Await will Make Your Code Simpler

With the rise of single-page javascript web apps and the widening adoption of Node.js, handling concurrency gracefully is more important than ever for Javascript developers.

Async/await alleviates many of the bug-inducing control-flow issues that have plagued Javascript codebases for decades and is pretty much guaranteed to make any async code block significantly shorter, simpler, and more self-evident.

About that hash flooding vulnerability in Node.js…

Early July this year, Node.js released a security update for all currently maintained branches to address a hash flooding vulnerability. This intermediate fix comes at the cost of a significant startup performance regression. In the meantime, V8 has implemented a solution which avoids the performance penalty.

In this post, we want to give some background and history on the vulnerability and the eventual solution.

Previously in the Node.js Weekly Update

In the previous Node.js Weekly Update we read about HTTP/2 for Node.js Core, the Constant HashTable Seeds Vulnerability, Cars.com's adoption story, and so much more..

We help you to stay up-to-date with Node.js on a daily basis too. Check out our Node.js news page and its Twitter feed!