The inside scoop on Node.js 9

in #nodejs98 years ago

First off just want to mention that Node.js 8.9.0 will have long term support under code name Carbon, this support will be maintained until 12-31-19. They have scheduled this to coordinate with OpenSSL-1.0.2.

Here is the link to the Node.js releases regarding all the repositories: Node.js Releases

Diving into Node.js 9

HTTP/2
HTTP2 began in Node.js 8.4 if you are unfamiliar with HTTP/2 here are some resources I recommend you take a look at:

You can start using the HTTP2 core Module:
Screen Shot 2017-11-12 at 4.21.18 PM.png

In order to use the code above you have to generate a private key & certificate:

  1. run cmd: openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
  2. enter localhost for common name when it prompts you.

If you need some reference regarding Node.js HTTP/2 check out their documentation here:
Node.js HTTP/2 documentation

Deep strict equal helper exposed in util

This method has been used since version 1.2.0, this was used for test purposes. It will throw if values don't match. The organization decided to expose this function because users modules needed this functionality. You can now use util.isDeepStrictEqual(value1, value2) methods to compare values:
Screen Shot 2017-11-12 at 4.29.03 PM.png

callbackify added to util

util.promisify was added back in Node.js 8; because of incompatibility issues a method to convert promises to an error-first, callback taking function.
Screen Shot 2017-11-12 at 4.31.23 PM.png

Static error codes

Static error codes have started to appear recently in Node.js core. This was used to solve the problem of string comparisons when there was a throw. It would have appeared like this:
Screen Shot 2017-11-12 at 4.33.09 PM.png

Even if you tried to fix a typo this would still cause a semVer major change. If you follow the paper trail it just gets worse as you fix the miss leading errors. Node.js has integrated static error codes to address this concern.

The code above could have been written like this instead:
![Screen Shot 2017-11-12 at 4.35.23 PM.png]
()

Two-Factor Authentication for npm

The new Node.js 9 comes with npm 5.5.1 this includes the two-factor auth. It is recommended if you are writing to enable this feature.