The Node.js Update #Week 12 - 22 March, 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.
Announcing NestJS 6: What’s New?
This new major release brings lots of amazing features. There are far too many to list, but let’s take a high-level look at some of the most exciting ones!
- Injection scopes: The IoC container now has another granularity level which allows us to create new injection scopes — Transient Scope, and Request Scope.
- Platforms: Extracted all platform-specific functionalities into separate packages, such as
@nestjs/platform-express
- Events: Introduced event-based messaging. With this paradigm, you can simply notify different service by emitting a message.
- GraphQL ❤ TypeScript: With 6.0.0, Nest has been integrated with an amazingtype-graphql package which lets you generate your GraphQL files using only TypeScript decorators!
- CLI: The CLI will now support prompts. Also, added initial
nest g lib
support that should lead to an easier monorepo development (even better code modularization). - Migration from Nest 5: In order to migrate your existing project, follow the guidelines that are available here. Also, make sure to get rid of all deprecation messages that may appear in your console.
Node v11.12.0 (Current) Released
Notable Changes:
- bootstrap: Add experimental
--frozen-intrinsics
flag - build: Enable v8’s siphash for hash seed creation
- deps: Upgrade openssl to 1.1.1b
- process: Make
process[Symbol.toStringTag]
writable again - repl: Add
util.inspect.replDefaults
to customize the writer - report: Rename
triggerReport()
towriteReport()
How to Build and Deploy a Cloud Native Node.js App in 15 Minutes
The goal of this tutorial is to show how you can turn a simple Hello World Node.js app into an application running on Kubernetes with all the best-practices applied.
The tutorial shows you how to use the assets and tools provided by CloudNativeJS in order to build an enterprise-grade application, turn it into a Docker container image and then deploy that image easily on Kubernetes.
A Complete Guide to Threads in Node.js
worker_threads
provide a fairly easy way to add multithreading support to our applications. By delegating heavy CPU computations to other threads, we can significantly increase our server’s throughput. With the official threads support, we can expect more developers and engineers from fields like AI, machine learning, and big data to start using Node.js.
This article discussess:
- worker_threads
- Exchanging data between threads
- Two ways of using workers
- Useful properties available in the worker_threads module
- Implementing setTimeout
- Implementing a worker pool
Build Structured Web Socket Backends in Node with Hexnut
Hexnut is a middleware based, super lightweight framework. It can work hand in hand with frameworks like Express and Koa, even sharing the same underlying server object! It only really has two important concepts:
- When the client connects to the server, a special Context object is created which lives for the lifetime of the connection. The ctx object (as it’s typically named) is used to communicate with the client, and to build up state as messages go back and forth.
- Connections, messages, and closing events are handled in a middleware chain. When these events come in, certain properties on the ctx are set to indicate what kind of event it was, and the same ctx object is passed to middleware functions. The middleware can be used to set properties and to send messages to the client, and it can also choose whether the next middleware in the chain should be triggered.
Node.js Continuous Deployment in Google Cloud with Kubernetes & Container Builder
So you want your app to be deployed to your Kubernetes Cluster without caring about any manual step? I got you covered, it’s super simple to create a Continuous Deployment Pipeline with Google Cloud.
For the sake of understanding I choose an Node.js Express Application, but it also works with react or PHP or any other application layer.
Originally published at community.risingstack.com on March 22, 2019.