What's your rating of Node js

What actually is Node.js?

Anyone who spends a lot of time on the web and is interested in generating dynamic content on websites has inevitably stumbled across the term Javascript. Almost every website that offers more than just static text, a few images, and information probably uses Javascript. Because of this, the term is much better known than Node.js.

While some have heard of or read about Node, they have never used it or used it on projects. In today's blog article you will learn what you can do with the Javascript Framework, why it is enjoying growing popularity, where the strengths lie and why you may have had more experience with Node.js than you think.
  1. Explanation of Javascript
  2. Explanation of Node.js
  3. Advantages of Node.js
  4. Node.js near Mittwald

Explanation of Javascript

The Javascript programming language enables you to design your website flexibly and to adapt content dynamically. Classic application examples for this are "sliders", with which you can intuitively search through your picture gallery, or code snippets, which adapt the size of the container to your customer's device and thus ensure an optimal display. Furthermore, user entries can be checked for a specific scheme, which you can use to ensure that the e-mail field can only be sent with valid input. As in any other programming language, you have the means to implement logic and conditions that allow you to control your website.

But Javascript can do a lot more than just that. You can provide your customers with simple applications such as a live ticker, but also highly complex applications or small 2D / 3D games. Google Maps is a very good example of how powerful Javascript can be.

I lean far out of the window and claim that almost every web developer has already used Javascript to give an element of the DOM (Document Object Model) a different CSS style or to add content to a list afterwards. The DOM is the interface between scripts such as Javascript and the elements of your website. All images, texts, tables and their styles can be addressed and changed by the DOM, which means that you can switch the color scheme from light mode to dark mode by pressing a button or dynamically adapt a menu to a terminal device if its resolution increases is low. Javascript is executed by your browser on your PC or smartphone after the HTML and CSS have been loaded - so we generally speak of code execution on the client side (also called frontend).

Node.js is a runtime environment for Javascript that does not rely on a host application such as a web browser. This means that Javascript can also be run on the server side (also known as the backend) and used to develop server-side scripts, tools and web applications. This also makes Javascript attractive for backend developers, because otherwise knowledge of other programming languages ​​such as PHP, Python, Ruby or ASP.NET is required for such areas of application.

With Node.js one would like to standardize the web development and get the possibility to use a programming language - both in the frontend and in the backend. This has a number of advantages:

  • Javascript is one of the easier languages ​​to learn
  • You can use the same naming conventions in the frontend and backend, so that you have a tidy and consistent code base
  • As a developer, you no longer need different tools for development, but can continue to use the tools you are already familiar with

While Javascript is mainly used in the frontend to manipulate the DOM, Node is mainly used to receive data in the backend, save it in databases (SQL, MongoDB, ...) and deliver the processed data again.

What do I need backend services for? Many applications on the Internet, apps on your computer or smartphone are pure operating elements for the customer. The apps themselves communicate with the backend services via an interface (API - Application Programming Interface) and exchange data. The actual work takes place in the backend (on servers in the data center or in the cloud). There the data is received, checked for validity and saved in a database. Depending on what kind of service it is, further processes are triggered (e-mails or push messages sent, workflows started, ...), your data is processed and sent back to you in some form, where you can put it in your app.

What makes Node.js so special? On the one hand, Javascript is one of the languages ​​that is easier to learn and thus represents a smaller entry hurdle. Furthermore, Node is highly scalable and processing the data is fairly quick. One of the reasons for this is that Node can work asynchronously and in parallel. Non-blocking I / O is the keyword here, because started functions do not have to wait for an action to be completed. Normal Javascript is actually "single-threaded" and processes data sequentially, which means that only one action can be started at the same time - and when this action is processed, the remaining components wait for completion. An asynchronous event system is provided for this, which enables parallel work without having to use complex multi-threading architectures. At Node, the calling function is notified of the end of the process using a callback function, and other tasks can be processed in parallel in the meantime.

In addition to the performance, a package manager is included (npm - Node Package Manager), which provides you with a huge (if not the largest) number of open source packages that are freely available to you and ensure that you can use the bike don't have to reinvent. So you can get started right away with the core logic of your services. With the help of npm, modules and all their dependencies can be searched for, installed, kept up-to-date and deleted again.

Our developers at Mittwald in product development also rely on Node.js. Along with Golang, Node is the second main programming language used to create backend services. Depending on the purpose of the service, a decision is made as to which programming language is used and which is more suitable. The developers also have their preferences, but in the end each of the languages ​​has its advantages and disadvantages and based on the strengths, the right language is then decided.

If you are now in the mood for the topic, then you will be happy to hear that we are currently working on offering you Node.js as a customer. We'll keep you up to date here.

Tobi works in product development at Mittwald. As Product Owner, he and the Hosting Basics team take care of domains, DNS, SSL and e-mail. In his spare time he enjoys doing sports, bouldering and snowboarding in winter. But he doesn't say no to a LAN party either.