Learn free nodejs tutorials


Multiple ways to Call REST API from Nodejs Application| Consume REST API

September 22, 2021 ·  2 min read

Sometimes, Application requires to call Remote or external API from a nodejs Application. It covers following items How to call remote REST API from nodejs application How to get data from http get request data How to make http get and post request Get HTTP request body in nodejs Process post request in NodeJS Nodejs is server side code based on npm libraries. Consume REST API involves http requst of type GET/POST/DELETE/PATCH...


How to execute shell script file from Nodejs Application

September 21, 2021 ·  4 min read

Sometimes, We want to execute the shell or bash script files from nodejs code, This tutorial talks about how to run shell script files from a javascript code and commandline in nodejs application. Why we need to run shell script file from nodejs programm It is helpful to automate the server side tasks with running unix shell script from javascript program Batch job execution to send email or copy or delete or sync files between file systems....


Learn npm runtime configuration file| .npmrc file example

September 20, 2021 ·  4 min read

Did you observed nodejs project has sevaral rc dot files like .npmrc, .babelrc in a project In this tutorial, Learn about contents of npmrc with below things npmrc file create how to add registry and scoped multiple registries npm config set,get list npmrc authtoken configuration npmrc file location in windows How to create a npm runtime configuration npmrc sample file example parsing rc file in nodejs For example,We have different rc files in different applications...


Nodejs URL and domain validation with examples

September 19, 2021 ·  2 min read

This is an short tutorial on how to validate below things in Nodejs Application validate URI domain name validation validation on uri is to check valid url or not and Domain validation is to check url contains http or https and extension is presnt How check Domain url validation with http or https in nodejs Some times, We want to check abc.com is valid url or not nodejs provides valid-url npm package to validate...


Multiple ways to read local json file in Nodejs application

September 17, 2021 ·  3 min read

In this tutorial, multiple ways to read local json file in Nodejs application using required js fs module readFile Let’s declare an local json file in the nodejs project emp.json { "id": 1, "name": "John", "salary": 5000 } easy way to read local json file with require function in nodejs This is an simple and easy way to read using require function const json = require("./emp.json"); console.log(json); It directly reads file as an object from local file....


How to read keystrokes from standard input in nodejs example

September 16, 2021 ·  2 min read

Some times, Nodejs code allows to listen the keyboard events to do some processing related to hardware or script automation. Keyboard has different events keypress keydown Nodejs has a inbuilt object called process which has stdin function to read stream from keyboard network. Nodejs read keystork data and display to user In this example, Create an stdin object using one the below approaches var stdin = process.openStdin(); or var stdin = process....


Guide to Package.json file tutorial in Nodejs Applications

September 15, 2021 ·  6 min read

In this blog post, We are going to learn package.json tutorials with examples Package.json file  package.json is a JSON configuration file of a nodejs and javascript based projects. It contains key and value of Nodejs based applications. This always placed in application root folder. This will be used by npm command for build/start/testing your javascript based applications. This will help other developers to track the application dependencies and versions...


Nodejs v8 getHeapSpaceStatistics method | Heap space statistics in node

September 15, 2021 ·  3 min read

In this tutorial, You learn v8.getHeapSpaceStatistics() method in v8 module of nodejs with examples getHeapSpaceStatistics method returns statistics about heap sizes based on spaces. v8 is an opensource javascript engine from google chrome and used by nodejs and Mongodb What is a space in v8? Space is an chunk of memory allocated by v8 engine. V8 has a following different spaces for storing and garbage cleaning object in heap memory....


NodeJS v8 getheapstatistics method| How to find heap size?

September 14, 2021 ·  2 min read

In this tutorial, You learn getHeapStatistics method in v8 module of nodejs with examples This includes how to find below things from javascript code How to get the value of max_old_space_size from the code? get max heap size of an nodejs application Retrieve heap memory for string objects total_available_size max-old-space-size V8 is an engine is used internally by Nodejs environment. You can check v8 version and 32 bit or 64 bit for Nodejs...


How to check the built nodejs environments v8 engine version

September 10, 2021 ·  2 min read

The V8 engine is used internally by Nodejs, a javascript runtime environment. Every year, JavaScript introduces new features into the language. To implement these features into a nodejs project, we need to use either babel plugins or a v8 engine version that supports the new javascript features. This post discusses various methods for showing the V8 version of the Nodejs Environment. The command-line utilities node and npm are included with Nodejs....


Different ways to fix out of memory issues in nodejs heap and process

August 22, 2021 ·  2 min read

In this article, Discussed about how to fix out of memory errors in Nodejs Javascript or nodejs apps throws the below error stack trace Some times, Running Nodejs application throws an below errors and crashed the application. FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed — process out of memory What is Out of memory issue? An application needs some memory to run javascript programs....


How to get return url in nodejs application|http referrer header example

August 21, 2021 ·  2 min read

Some times, We need to get Referer http header in Node application. This post explains about how to find the referer url in Nodejs application. This tutorial describes all the steps to retrieve referer in javascript [Referer](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.36) is an http optional header in a request contains domain or a page URL making request. some times Referer is also called referrer as old browsers still reference this. We can use any one of this....


Scaffolding your Nodejs Express Application| Express Generator

June 30, 2021 ·  4 min read

ExpressJS is an Framework for building backend applications using Nodejs yeoman is a popular tool to scaffolding an applications in modern javascript applications. These tools generates standard application prototype with required files to start up and running including folder structure, build files and dependencies Expressjs has a scaffolding tool. There are two ways to easily generate express application using npm commands. using express-generator tool from expressJs framework Expressjs generator for Yeoman express-generator express-generator is a command line tool that helps in quickly create an application....


Nodejs, How to Convert xml to CSV| Javascript

June 27, 2021 ·  3 min read

You can check more about xml and json types Nodejs Application In Javascript, There is no direct solution to convert xml to json, We have npm library @wmfs/xml2csv . First, Let’s create a nodejs application using npm init command npm init npm init -Y This command creates nodejs application with all default values Next, Install @wmfs/xml2csv dependency to application using below command npm install xml2csv --save This adds dependency in package....


How to check the file/path exists in Nodejs?

June 26, 2021 ·  2 min read

This is an short tutorial how to check an file exists in file system with nodejs code. There are many ways we can check file exists in Nodes Using existsSync and exists fs access and accessSync Async and await promises File checking can be done Synchronous and asynchronous exists function fs provides two functions to check file path exists in a OS file system. exists: This is an asynchronous way of checking existsSync: Synchronous way of checking file exists or not...


2 ways to Convert xml to JSON in Nodejs | Javascript

June 25, 2021 ·  4 min read

This tutorials explains about how to convert XML to JSON In javascript and Nodejs Applications. XML is extension markup language which contains properties or tags in the parent tag relation. JSOn is simple format to have a key and values pair enclosed in parenthiss{}. Both are used to store different types of data, There is no manual conversion from type to another in nodejs and javascript You can check more about xml and json types This post talks about How to convert...


Fix for error package.json not found in npm install running

June 23, 2021 ·  3 min read

In this blog post, We are going to learn how to fix package.json not found in npm command. npm install package.json error package.json is a JSON configuration file of a nodejs project which contains metadata of an application + dependencies etc. In NPM based applications like nodejs, Angular, VueJS and ReactJS applications, package.json file location is the application root When you are creating a new project manually or when installing dependencies of a project we used to get the following errors...


How to add Lodash in Nodejs with examples?

June 21, 2021 ·  4 min read

We already covered some basics of lodash library in front-end applications. You can check other posts cover the basic usage in Client-side applications Learn Lodash basics with examples Import Lodash in Angular applications This article walks through the how we can use lodash in backend application using nodejs. Nodejs environment has node package manager tool which is prerequisite before start using. Please make sure that npm –version command works as below....


npm-check-updates update packages in package.json and bower.json | ncu command in nodejs

June 21, 2021 ·  4 min read

In this blog post, We are going to learn npm-check-updates npm package to update dependencies in package.json and bower.json. npm package update npm check updates package is used to check all dependencies in package.json of a node js project and update dependencies to latest versions. This package works by updating following configuration files package.json  bower.json This library solves all below problems of a NodeJS application How to update all dependencies in package....


Understand nodejs Basics - webserver tutorial

June 3, 2021 ·  2 min read

Understanding Nodejs  Nodejs is an opensource framework for building Server-side applications based on javascript. It is javascript runtime based on Chrome V8 Javascript engine. Basically, You can write your own web server using this environment. Nodejs is growing popular day by day because of its features, simplicity, and architecture. Nodejs can be run on any operating System like Windows, MacOS, and Linux/Unix/Ubuntu. It is platform Independent. Nodejs Advantages or pros Provides Non-Blocking and Event-Drive programming features to handle the concurrent request It is based on javascript Scalable and network applications can build with simple code Simple to learn It is a single threaded model Performance is very good as it uses javascript in the server side Disadvantages or cons Learning Curve Not suitable for Multithreaded Model Not enough tools  Basic Web server Example the web server is a server which clients send the request to the server, in turns server returns response....


gitignore nodejs |how to ignore node_modules

April 9, 2021 ·  2 min read

This post talks about how to add .gitignore file to nodejs applications and it its contents. .gitignore is a file that contains entries of name of files and folder path which are ignored in a project while committing source code to nodejs projects. which files or folders are ignored in nodejs applications? dependencies log files dotenv environment variables configuration serverless folder IDE related configuration cache files typescript and javascript related files how to ignore node_module dependencies in gitignore files node_modules dependeices: There are lot of dependencies configured in package....


How to copy directory with npm script copyfiles npm

March 18, 2021 ·  3 min read

This tutorials covers how to copy files with script tags command in package.json copy files from one folder to other folder npm script to copy directory including nested directory There are many npm packages to copy files, In this example I am going to use copyFiles npm package. Advantages with npm copy As you are not worry about remembering the copy command in OS environment, This will take care of running on Windows, Mac, Unix flavours...


Sass compile and watch changes Nodejs|node-sass tutorial

February 4, 2021 ·  4 min read

Nodejs SASS npm library Sass is an pre-processor language that converted to CSS, It provides lot of features variables, inherence and mixins. SASS offers two different syntax and not covering detailed syntaxes in this post. SCSS SASS Sass is SASSY CSS with indent syntax, that means no braces,semicolons and only indentation. scss syntax is similar to CSS with braces and semicolons. Npm has a module called node-sass to convert SASS/SCSS into CSS files....


Nodejs, How to Convert Relative to Absolute path| Javascript

January 29, 2021 ·  2 min read

In this short tutorial, You will learn how to convert relative path to absolute path in Nodejs Application with example. absolute path and relative path in Nodejs Absolute path is path of the resource starts from application root, always starts with /. Relative path is path of of the resource relative path of an resource, it will not starts with /. For example, Let’s have a NodeJS application has directory or folder structure as follows...


Nodejs, How to Convert word document to pdf | Javascript

January 28, 2021 ·  3 min read

In this post, You will learn how to convert docx file to pdf document in JavaScript and nodejs. Docx/doc are document file formats from Microsoft, contains images, text, tables and styles PDF files are from Adobe company, which is separate format for representing the content of images, texts and styles There are lot of online tools to do the conversion doc to pdf. Sometimes, As a programmer you need to have a conversion of different formats in the JavaScript/NodeJS applications....


Nodejs, How to Convert Buffer to ArrayBuffer

January 27, 2021 ·  2 min read

In this post, Learn how to convert buffer to/from ArrayBuffer in Nodejs application with example. Buffer is an object in Nodejs to represent fixed length of bytes. ArrayBuffer is also stores the fixed length of array of binary bytes data in javascript. Data inside arrayBuffer can not be read directly but you can use Data view Object or typed array only. Some of typed Arrays are Int8Array, UInt8Array, Float32Array etc.....


How to measure time taken by function to execute Javascript

January 26, 2021 ·  3 min read

In this blog post, JavaScript offers ways to calculate measure (elapsed) time taken by a function execution in JavaScript and NodeJS. Sometimes, we need to know function execution time while profiling an JavaScript application for performance improvements This will be very useful to pin point the problem method for time taken. Time elapse taken in JavaScript Measuring time in NodeJS. How to measure time taken for function execution using console object Console object is inbuilt JavaScript object useful for getting debugging information during development....


How to update dependency to latest in nodejs|npm outdated

January 5, 2021 ·  4 min read

In My previous nodejs application, I have a need to convert all dependencies to latest. This blog talks about how to upgrade all your packages to latest version This post solves developers questions while nodejs update latest packages How do update each dependency in package.json how to update all packages manually or automatically how update global packages to latest versions update dependencies and devdependencies Nodejs project all dependencies maintained in package....


Dependencies vs devDependencies vs peerDependencies in Nodejs

March 12, 2020 ·  3 min read

Define dependency in nodejs application. In Nodejs projects, npm is the default package manager to manage the dependencies. In every application development on any language, dependencies are required to build and start running the application. Every application has a dependency tree that contains all direct and indirect dependencies. Dependency is a module or library code that is required to execute the application. each dependency is also called a package, which can be declared in a package with each object contains the name and version....


Top nodejs node and npm command line tools tutorials

July 10, 2016 ·  3 min read

Basics of Nodejs Server Nodejs is a server platform for deploying web applications using javascript. Nodejs server is very famous in the current industry for asynchronous request processing We can use nodejs for streaming-based applications. NodeJS is a free and opensource application to develop server-side applications Nodejs is popular because of event-driven and modularity based architecture Nodejs installation comes node and node packaging manager (NPM) tools. Npm is a node package manager which is the command line for the nodejs runtime environment....


Subscribe
You'll get a notification every time a post gets published here.