Language: EN

introduccion-curso-nodejs

Introduction to Node.js

Node.js is an open-source runtime environment used to run JavaScript code on the server side.

That is, Node.js is a program that allows us to run programs written in JavaScript. You write your program in JavaScript, and Node.js’s function is to take your code and execute it (that’s why it’s called a “runtime environment” 😉).

When we say “on the server side,” we mean that, thanks to Node.js, JavaScript no longer has to run exclusively within a web page. But this does not mean that Node.js is only for servers.

You can install Node.js on your home computer and use it for whatever you want. For example, to write your shopping list at home, so you don’t forget to buy sweet potatoes 🍆. Or to list the files in a folder… to make whatever program you want.

node-js-javascript-server

JavaScript happy to run on your computer

When Node.js appeared, it was a small revolution. It was 2009, and neither computing nor JavaScript were what they are today. At that time, JavaScript was executed (almost) exclusively in the browser when it displayed a web page.

Until that moment, server-side technologies were mainly based on languages like PHP, Ruby, Java, and Asp.NET. There was no runtime environment for using JavaScript, apart from a web browser.

But Node.js changed everything. Now we can run JavaScript to perform tasks outside of a web page, such as managing files, interacting with databases, and creating web servers on your computer (or on a server).

How Node.js Works

Node.js is based on Google’s V8 engine, which compiles JavaScript code into machine code, rather than just interpreting it. This makes it highly efficient and extremely fast.

node-js-v8

Not that kind of engine, but almost

One of the most innovative aspects of Node.js was its non-blocking I/O model. This allows handling multiple requests simultaneously without blocking the execution flow.

Another feature is an event-driven programming model. This means that operations like file reading or network requests are handled as events. When an event occurs, the corresponding callback is executed. This makes Node.js very efficient in handling asynchronous operations.

These three features were aimed at serving scalable, high-performance web applications that catered to a large number of requests. Such as online chats, multiplayer games, collaborative applications, and more.

Node.js as a Development Tool

Regardless of the fact that Node.js emerged as a technology to create web application back-ends, it quickly started to be used for many other things.

Thus, many tools focused on improving the developer experience were created. If, for example, you had to copy some files on your computer (not on a web server, on your computer), with Node.js you could make a simple script.

nodejs-herramientas-desarrollo

By using JavaScript, web developers felt very comfortable using the same language they already knew and used every day (there was no need to learn another language; you could use JavaScript for everything).

Both Node.js and JavaScript benefited from this. Thus, many many (I repeat, many) tools were developed to help you in development. It’s a self-reinforcing circle.

With this, a large community of developers and a wide user base was generated. This means that there are a large number of resources, tutorials, libraries, and frameworks available to assist in application development.

Additionally, many leading companies like Netflix, PayPal, Uber, and LinkedIn use Node.js in their applications. This adds more weight and reliability, which encourages other companies to use it as well.

So much so that today Node.js is an essential tool in the development world. Not only as a web server but also because literally, almost anything you want to do today in development requires using Node.js.

Of course, like everything that succeeds in life, competitors and alternatives have also emerged. But, in general, trying to be Node.js-compatible has become almost a de facto standard.

And for that reason, we start this Node.js course where we will see the use of this tool that, to this day, you should know if you’re in the development world.

Related, check out the NPM course