Category: 01. Tutorial

  • Node.js DNS

    The Node.js DNS module contains methods to get information of given hostname. Let’s see the list of commonly used DNS functions: Node.js DNS Example 1 Let’s see the example of dns.lookup() function. File: dns_example1.js Open Node.js command prompt and run the following code: Node.js DNS Example 2 Let’s see the example of resolve4() and reverse()…

  • Node.js Timer

    Node.js Timer functions are global functions. You don’t need to use require() function in order to use timer functions. Let’s see the list of timer functions. Set timer functions: Clear timer functions: Node.js Timer setInterval() Example This example will set a time interval of 1000 millisecond and the specified comment will be displayed after every…

  • Node.js OS

    Node.js OS provides some basic operating-system related utility functions. Let’s see the list generally used functions or methods. Index Method Description 1. os.arch() This method is used to fetch the operating system CPU architecture. 2. os.cpus() This method is used to fetch an array of objects containing information about each cpu/core installed: model, speed (in…

  • Node.js Global Objects

    Node.js global objects are global in nature and available in all modules. You don’t need to include these objects in your application; rather they can be used directly. These objects are modules, functions, strings and object etc. Some of these objects aren’t actually in the global scope but in the module scope. A list of…

  • Node.js Command Line Options

    There is a wide variety of command line options in Node.js. These options provide multiple ways to execute scripts and other helpful run-time options. Let’s see the list of Node.js command line options: Index Option Description 1. v, –version It is used to print node’s version. 2. -h, –help It is used to print node…

  • Node.js Package Manager

    Node Package Manager provides two main functionalities: The npm comes bundled with Node.js installables in versions after that v0.6.3. You can check the version by opening Node.js command prompt and typing the following command: Installing Modules using npm Following is the syntax to install any Node.js module: Let’s install a famous Node.js web framework called…

  • Node.js REPL

    The term REPL stands for Read Eval Print and Loop. It specifies a computer environment like a window console or a Unix/Linux shell where you can enter the commands and the system responds with an output in an interactive mode. REPL Environment The Node.js or node come bundled with REPL environment. Each part of the REPL environment has…

  • Node.js Console

    The Node.js console module provides a simple debugging console similar to JavaScript console mechanism provided by web browsers. There are three console methods that are used to write any node.js stream: Node.js console.log() The console.log() function is used to display simple message on console. File: console_example1.jsPauseNextMute Current Time 0:01 / Duration 18:10 Loaded: 3.30%  Fullscreen Open Node.js command…

  • Node.js First Example

    There can be console-based and web-based node.js applications. Node.js console-based Example File: console_example1.js Open Node.js command prompt and run the following code: Here, console.log() function displays message on console.Backward Skip 10sPlay VideoForward Skip 10s Node.js web-based Example A node.js web application contains the following three parts: How to create node.js web applications Follow these steps:…

  • Install Node.js on Linux/Ubuntu/CentOS

    We can easily install Node.js on linux/ubuntu/centOS/fedora/linuxmint etc. To install Node.js on Linux (Ubuntu) operating system, follow these instructions: 1) Open Ubuntu Terminal (You can use shortcut keys (Ctrl+Alt+T). 2) Type command sudo apt-get install python-software-properties 3) Press Enter (If you have set a password for your system then it will ask for the password) 4)…