How to Install Node.js and Build Your First Application

1 min read

Installing Node.js is pretty easy and we will be go through the steps involved in setting up Node.js on a Windows or Mac computer.

Step 1

Open up the terminal on Mac, or the command prompt on Windows to confirm if you already have Node installed. This can be done by typing node -v or node –version on the command prompt. The version should be displayed as shown below, if it has been installed.

If not installed, open up the Node.js official website on your favorite browser to download the recommended version for Windows or  Mac OS.

Step 2

Double click on the downloaded file to begin Node installation. Follow through the instructions that appears on your screen. Confirm the version installed by repeating step 1, once the installation is complete.

Step 3

Now it is time to write our first Node application. Create a folder somewhere on your computer. In my case, I have created a folder named FirstNodeApp.

Step 4

Open up the created folder in your favorite code editor. This could be Atom, Sublime, Visual Studio code editor or any other one you are familiar with. Create a file named app.js inside the folder.

Step 5

Below is a simple javascript function that outputs a welcome message to the console upon execution. copy and paste the code snippet into the app.js file and save.

Step 6

It’s now time to execute the code written in step 5. Go back to the terminal or command prompt, making sure that you are inside your current project folder. Type the command node app.js and press the return key. At this point, Node sends the file app.js to the V8 engine for execution and the result is the program output as shown below.

At this point, we have successfully run a javascript code outside of a browser with the help of Node.js

HTTP Put and Delete Requests – Building Restful APIs…

In order to update or delete an information, we need have the object ID. Let's analyze the code block below for handling HTTP Put...
1 min read

Validating POST Request – Building Restful APIs using Express:…

It is important to have a validation mechanism that validates inputs when building web services. Read more as we use the joi package to...
2 min read

Building Restful APIs using Express: Part 6 – POST…

In this section, we will discuss how to use http POST request to create a new radio station. We will test endpoint using the...
2 min read

One Reply to “How to Install Node.js and Build Your First Application”

Leave a Reply

Your email address will not be published. Required fields are marked *

Never miss a tutorial from us, get weekly updates in your inbox.