- Quick start guide
- System requirements
- Installation guide
- User guide
- Developers guide
- SMS from SQL
- C# SMS API
- HTTP SMS API
- PHP SMS API
- VB.NET SMS API
- Programming APIs
- C# SMS tutorial
- VB SMS tutorial
- F# SMS tutorial
- Java SMS tutorial
- Node.js SMS tutorial
- Node.js send sms
- Node.js multiple sms
- Node.js schedule sms
- Node.js receive sms
- Node.js delete sms
- Node.js sms Github
- Node.js and vscode
- Kotlin SMS tutorial
- C/Cpp SMS tutorial
- Delphi SMS tutorial
- PHP SMS tutorial
- Perl SMS tutorial
- Python SMS tutorial
- Python flask SMS tutorial
- Ruby SMS tutorial
- Tcl/Tk SMS tutorial
- Go SMS tutorial
- R SMS tutorial
- Scala SMS tutorial
- Objective C SMS tutorial
- Service providers
- Administrators guide
Node.js tutorial: Hello world
This tutorial helps you get started with Node.js. It explains what you need to write your first Node.js program. It starts with the basics: you will learn where you can find and download the tools needed, how to install these tools and it will take you all the way to building and runing your code. If you have never written a Node.js program before this is the place to start. We have created this article, so you can get started with Node.js, and move on to our sms examples. If you are already familiar with Node.js, you can jump directly to one of the following SMS projects.
Node js sms examples:
Node js send sms with the HTTP rest api (code sample)
Node js send multiple sms with the HTTP rest api (code sample)
Node js schedule sms with the HTTP rest api (code sample)
Node js receive sms with the HTTP rest api (code sample)
Node js delete sms with the HTTP rest api (code sample)
Node.js tutorial: Hello world!
Download the latest Node.js sms api library from Github
What is Node.js
What is a Node.js Hello world program
A hello world program is the most simple program you can write. It simply prints out the sententce: Hello world on the computer screen. The Hello World program is the first program developers write in any programming language.
How to write your first program in Node.js
To write your first program in Node.js:
- Download Node.js installer
- Install Node.js
- Test if Node.js is installed
- Write Hello World program script
- Use the console.log() command
- Run the code in the Command prompt
- Check the output
- Fix the errors
- Windows 10 computer
- Ozeki Hello World example project
To get started, you need to download the Node.js installer to your computer (Video 1). You may download Node.js from the following URL: https://nodejs.org/en/download/current/
Download Node.js installer
To start coding in Node.js you first need to download the installer for the coding enviroment First, go to https://nodejs.org/en/download/current/. Click on the Downloads tab on the top of the page. This will bring you to the downloads page. Next, find the Windows Installer (.msi) option in the downloads (Figure 1). Click on the version intended for your operating system (32 bit or 64 bit). This will download Node.js installer on to your computer.
To write your first Node.js program, you need to install visual studio code. The following video shows you how this installation can be done.
To test if Node.js is installed, you have to open the Command Prompt.
- Open the Start menu
- Type "cmd" into the search field
- Click Enter
- You will see a black window
- Type the code into the terminal what is in (Code 1)
Test if Node.js is installed
Write the 'hello world' script
This video shows you how to create and write the 'hello world' script. We simply create a .js file and edit it using Notepad (Video 3).
Running your 'hello world' script in the Command Prompt
/*If you named your project otherwise you should replace the 'helloWorld' part with the name you gave to your file*/ node helloWorld.js
To run your code use the following code snippet above. If you placed your file somewhere else, your should use the cd command to go into that directory. It is enouch to copy the relative path and place it after the cd command.
Run the code in the Command prompt
Output of the code
Run your script by opening up the Command Prompt again, and entering the following command: node helloWorld.js (Figure 3). The output of the code will then appear in the next line. When the script is executed, the Command Prompt will display the "Hello World!" message.
Make an error and fix an error in Node.js
If you make a mistake in your code and you run it, the complier will show you the number of errors and it will maerk the palce where the error occured.
How to handle a syntax error in Node.js?
In the code below we will create a syntax error intentionally by not putting a semicolon after the Hello World line. You will see, how the computer reacts, how we fix the error, and how we run the computer program successfully.
Error in the script
When an error occours, the compiler alerts the developer that the code has an mistake in it. In the Command Prompt you can see a line of arrows pointing up below the faulty line (Figure 4). This is to indicate where the error happened. This is followed by an explanation to why the error happened.
This tutorial helps you get started with Node.js by showing you how to write your first Hello World code. We have tried to make this tutorial as simple as possible so that you can see that coding in Node.js is way not as complicated as it may seem for the first time. This knowledge helps you to understand other Node.js programs and gives you the ability to learn how to create your solution.
If you want to learn more about using Node.js programs, you can find more tutorials on the Ozeki website. Do not stop here, move on to the next document and study how to send SMS from Node.js.
Start the journey, download the Ozeki SMS Gateway now!
- C# SMS tutorial: Hello world
- Visual Basic SMS tutorial: Hello world
- F# SMS tutorial: Hello world
- Java SMS tutorial: Hello world
- Kotlin SMS tutorial: Hello world
- C/C SMS tutorial: Hello world
- Delphi SMS tutorial: Hello world
- PHP SMS tutorial: Hello world
- Perl SMS tutorial: Hello world
- Python SMS tutorial: Hello world
- Python flask SMS tutorial: Hello world
- Ruby SMS tutorial: Hello world
- Tcl/Tk SMS tutorial: Hello world
- Go SMS tutorial: Hello world
- R SMS tutorial: Hello world
- Scala SMS tutorial: Hello world
- Objective C SMS tutorial: Hello world
- Tutorials for software developers