Your Choice JavaScript News

Node News Wednesday, May 9 Nginx, Docker, Official site & more…


What’s new?

  • We will create a simple Node.js application that serves an HTML file, containerize it with Docker, and containerize an NGINX instance that uses round-robin algorithm to load balance between two running instances of this application.
  • As the instances of our Node.js application and NGINX will run inside Docker containers, we won’t need to install them on our development machine.
  • Now that we have both instances of our application running on different Docker containers and responding on different ports on our host machine, let’s configure an instance of NGINX to load balance requests between them.
  • The second one is to create a Node.js script with the following code: – – The code above creates the Express application and adds two middleware to it: to parse JSON requests, and to signal that the app accepts requests from any origin.
  • All we had to do was to install Docker on our development machine, run two instances of a dockerized applications and then configure a dockerized NGINX instance to round-robin requests to the application instances.

Tags: NGINX, NGINX instance, Docker, simple Node.js application, Docker containers


  • This is why you cant take full advantage of multiple core machines unless you use the cluster module or a process manager like PM2.
  • I was using the cluster module to – Run multiple processes of the app itself.Manage multiple child_processes for separate tasks like sending SMS, emails, notifications.In the code above, there is only one master in the cluster, I get one child process for each worker: – 1 smsWorker + 1 emailWorker…
  • The only thing left in this implementation is the process communication between the app workers and from app workers to the dedicated task (SMS/email/notif) workers.
  • After adding process communication, the final code looks like this: – I have defined global methods so that I can send messages from anywhere in the app to the worker.
  • Easy to implement process communication.Cons:You take a hit on performance of the app if there are too many messages.The implementation doesnt appear to be the best for managing communication of dedicated workers.You need to manage the process state by yourself (no automation).

Tags: cluster module, RabbitMQ, process manager, RabbitMQ exchange, RabbitMQ implementation


  • Circle is a global internet finance company, built on blockchain technology, powered by crypto assets, and dedicated to helping people everywhere create and share value.
  • With Circle Invest, were expanding our offerings with a cryptocurrency investment product, enabling anyone to buy and sell crypto assets.
  • Through Circle Trade, were market makers for the top crypto coins and offer OTC trading services.
  • Working out of either Boston or Dublin, youll get the opportunity to develop your skills, collaborate across teams and continue to learn.
  • We are an equal opportunity employer and value diversity at Circle.

Tags: blockchain technology, Circle Invest, global internet finance, Circle Pay, cryptocurrency investment product


Tags: best possible product, individual project priorities, CTO candidate, perfect candidate, following role


Top Node Courses

The Complete Node.js Developer Course (2nd Edition) (60,232 students enrolled)

By Andrew Mead
  • Build, test, and launch Node apps
  • Create Express web servers and APIs
  • Store data with Mongoose and MongoDB
  • Use cutting-edge ES6/ES7 JavaScript
  • Deploy your Node apps to production
  • Create real-time web apps with SocketIO

Learn more.


Angular (Angular 2+) & NodeJS - The MEAN Stack Guide (26,806 students enrolled)

By Maximilian SchwarzmĂĽller
  • Build real Angular + NodeJS applications
  • Understand how Angular works and how it interacts with Backends
  • Connect any Angular Frontend with a NodeJS Backend
  • Use MongoDB with Mongoose to interact with Data on the Backend
  • Use ExpressJS as a NodeJS Framework
  • Provide a great user experience by using Optimistic Updating on the Frontend
  • Improve any Angular (+ NodeJS) application by adding Error Handling

Learn more.