With Node.js, developers can create server side applications, command line tools, and more.
This article is not a crash course on how to use Node.js (you’ll find resources for that in the last section of this article). Rather, it’s an introduction to what Node.js is, its features, and what it is used for.
What is Node.js?
Note that Node.js is not a programming language – it’s a tool.
What Is So Special About Node.js?
In this section, we’ll discuss some of the features that make Node.js cool to use.
The aim is not to compare Node.js to other backend technologies, but to help you understand some of its functionalities.
Single Threaded and Asynchronous
Node.js is fast at executing tasks (receiving requests and sending back responses) because of its single threaded and asynchronous nature.
Let’s explain some of the terms above.
By single threaded, this means that Node.js has a single source for handling requests. Multiple threaded backend technologies allocate a new thread for every new request.
You can think of a thread as someone who renders a service to multiple people. A very popular real life example would be a restaurant. We’ll explain this example further along with the asynchronous part of Node.js.
Node.js is asynchronous because it can handle multiple requests simultaneously. Let’s get back to the restaurant example.
A customer gets to a restaurant and sits down waiting for a server. The server gets to the customer’s table and takes their order. The order is then taken to the kitchen.
But the server doesn’t wait for the order to be ready before proceeding to the next customer. They’ll return with what the customer ordered for when its ready – in the meantime, the server proceeds to the next customer and repeats the same process.
The example above is similar to how Node.js works under the hood. It is able to process multiple requests using a single thread asynchronously (without waiting for one request’s completion before moving to the next).
So when the response for a request is ready, it is sent back to the client.
The single threaded and asynchronous nature of Node.js makes it very fast and ideal for building data-intensive and real-time applications.
Before the release of Node.js, web developers had to learn a different programming language to build the backend of their web apps.
Fast Execution Time
Cross Platform Compatibility
Node.js supports many major platforms. So you can write your code and it will run on Windows, MacOS, LINUX, UNIX and even some mobile devices.
What is Node Used For?
Here are some of the cool things you can do with Node.js:
- Create HTTP web servers.
- Generate web pages dynamically.
- Collect and send form data to a database.
- Create, read, update, and delete data stored in a database.
- Create APIs.
- Build command line tools.
- Read, write, move, delete, and open/close files on a server.
In this article, we talked about Node.js. We first had a look at what it really is.
We then talked about some the features that make Node.js stand out.
Lastly, we saw a list of how you can use Node.js.
How to Learn Node.js
Now that you’ve had a brief introduction to what Node.js is, its features, and what it is used for, here are some resources that you can use to learn how to use Node.js:
If you read this far, tweet to the author to show them you care.