Node.js

The goal of this document is to introduce the use of Node.js in web development, have a first insight of Node.js, understand its working principles, identify its advantages/limitations, have a perception of different use-cases, and be able to develop basic applications based on this programming technology.

Introduction

There are many frameworks useid in web and backend development, each relevant in certain applications. The main competing tecnologies are:

  • Django (FOSS high level pyhon web framework, with lots of documentation and fast app development)
  • ASP.NET (Backend from Microsoft, despite being FOSS it is only available for the Windows OS, there is a new approach called ASP.NET Core that is compatible with Linux and macOS)
  • Node.js (It’s a server side, FOSS javascript runtime environment that enables fast and scalable development of web applications)


Node.js is not well suited for CPU intensive applications since the non-blocking processing would be always returning, but it is effective in distributed applications such as I/O bound, Data streaming, etc.
It is a low-level platform with a standard library with excelent support for networking.

In this document, we will use the Express library, which has become very popular for Node.js development, and Bootstrap for the web app frontend.

Instalation

        sudo apt update
        curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
        
        
        sudo apt install dirmngr gnupg apt-transport-https software-properties-common ca-certificates curl
        curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
        sudo add-apt-repository 'deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main'