As a server-side technology, Node.js has one obvious limitations that experienced full-stack or back-end web developers will notice. Unlike Java or ASP.NET, the language is interpreted rather than compiled. Compiled code already consists of processor instructions that anyone, even the most experienced software developers, would struggle to read. This is, however, the format that the CPU understands with the minimal amount of pre-processing. Interpreted code, however, is the code that is deployed in exactly the same state as it has been originally written in. Every statement is read and translated into a set of processor instructions in real time, which makes the execution somewhat slower. Another disadvantage of interpreted languages is that the production code is stored in easily accessible text files, while compiled code is stored in inaccessible binary format. Interpreted language is then, obviously, not the best choice for any closed-source app. Therefore, if you are working with a back-end technology that compiles into something that is fast and obfuscated, you may ask, why should I bother learning Node.js?
Flexibility achieved via Node Package Manager
What makes Node.js super-flexible and suitable for many types of applications is a tool that comes with it: NPM, which stand for Node Package Manager. For those ASP.NET developers who are familiar with NuGet packages or Java developers who are familiar with Maven repository will grasp NPM in no time. This tool allows developers to publish libraries, frameworks and various other tools and add-ons that work with Node,js into an online repository. You can use NPM in your command line to download any of the countless packages that are publicly available.
One of the key files in a Node.js application is package.json. This is a configurational file where you specify all dependencies from NPM repository that you will need in order to be able to run your application. When you launch your Node.js application, magic happens. The runtime will automatically download any dependency that is specified in the file. As well as this, an IDE's compatible with Node.js will highlight errors in your code when you forgot to add a critical dependency to your source.
Minification is the process of changing your code in such a way that it remains the same functionally, but becomes much more compact visually. This is achieved by removing non-functional characters, such as white spaces and changing descriptive variable names into single-letter identifiers. This makes your code much smaller than the combined size of all of the files that were combined to produce it. Also, it provides some degree of protection against unwanted attention. The process does not obfuscate the code to the same degree as compilation does, as the output code is still contained within text files. However, it makes the code difficult enough to read that most of people will not even bother. UglifyJS is one popular NPM library that is used to perform minification.
How Aurelia and Angular take advantage of Node.js infrastructure
If you will pick one of the frameworks and will go through its official tutorial written specifically for Node.js environment, you will see for yourself how easy it is to get started. So, give it a go. I am pretty sure that you will be pleasantly.
Written by Fiodar Sazanavets
Posted on 8 Feb 2018