Okay Tamal, you hear a lot about the fancy new Node.js thing.

You have installed it on your computer many years ago but not really sure what it is and what it does.

Well, today is your treat Tamal! I am going to teach you the very basics of Node.js with this helpful beginner-friendly tutorial.

By the end of this tutorial, you will learn how to put some words on the screen in the browser. But don’t underestimate it, this little introduction will help you build a solid foundation for building future SaaS like applications you have always wanted to build.

So let’s get started!!

Node compared to PHP, Python, Ruby on Rails:

People like to compare Node.js with PHP, Python and many other languages. But one thing you should know first,

Node.js is not a language.

It’s a platform that runs on a computer. It lets you use JavaScript to do various tasks.

With Node.js you can automate various tedious tasks on a computer. You do it by writing JavaScript code.

Such a tedious task could be converting a SASS file to CSS file instantly on save. So you don’t have to recompile it again and again.

Another boring task could be refreshing the browser everytime you hit save on your HTML document.

Node.js let’s you do all these things and it’s more web developer-friendly.

With the same technology, you can write server-side web applications.

Applications such as Twitter, Reddit, an e-commerce site or even a social network.

With Node, it lets you write your code in JavaScript for both front end view and back end scripting. For a forgetful person like you, it’s easier to just stick with one language and its paradigms than having to switch between JS and PHP every now and then.

Installing Node and other tools

You have to simulate your computer to act like a server. Just like you used XAMPP to run WordPress and PHP files. Only this time, it’s slightly less cumbersome.

Node commands are issued using a command-line interface. The default CMD program which comes with Windows is not going to cut it and is too lame.

So go ahead and download and install Git on your computer.

This will give you a neat little Bash terminal which you can use to type in various commands.

Git bash terminal in Windows

You have already taken the command line course from Codecademy, so it won’t be a pain to learn how to move from one directory to another.

To make things even more easier, you can just right click on a folder and click on Git bash here, this will open the terminal window with the selected document path already typed in.

Git bash here -opens up a terminal with the same path

To build stuff with Node, you will need to install Node ..duh!

So go to the official page of Node.js, download the installer and install it on your computer. If you want to know which version of Node to use, here you go.

Open your terminal anywhere and type:

node -v

This will show the version of your node, and it means you have correctly installed it.

Do another command:

npm -v

This will show you another version. NPM stands from Node Package Manager and it’s like a plugin repository of Node.js. Anything you want to implement on your application, you have to use NPM to install that package.

Let’s say you want to build an app which gets tweets from a twitter account. Instead of writing all the configuration/authentication yourself, you can install an existing package that does it for you.

I will also need a code editor to edit the node files. I use Atom code editor so that’s taken care of, no worries.

Now that it’s ready let’s set up a basic application.