Mayank Agarwal has Published 380 Articles

Creating an Agent in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:22:19

843 Views

You can use new Agent() method to create an instance of an agent in Node. The http.request() method uses the globalAgent from the 'http' module to create a custom http.Agent instance.Syntaxnew Agent({options})ParametersThe above function can accept the following Parameters −options – These options will contain the configurable options that could be set ... Read More

Changing the npm start-script of Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:21:38

10K+ Views

The start-script of a Node.js application consists of all the commands that will be used to perform the specific tasks. When starting or initializing a Node.js project, there are a lot of predefined scripts that will be created for running the application. These scripts can be changed as per the ... Read More

agent.createConnection() Method in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:20:24

545 Views

The agent.createConnection() method is an interface provided by the 'http' module. This method produces a socket/stream that can be used for the HTTP requests. One can use custom agents to override this method for greater flexibility. A socket/stream can be returned in two ways – either by returning the socket/stream ... Read More

SignUp form using Node and MongoDB

Mayank Agarwal

Mayank Agarwal

Updated on 29-Apr-2021 09:30:47

3K+ Views

In this article, we will create a simple user sign-up form having some parameters. On clicking SAVE, all the user details will be saved in the MongoDB database.InstallationBefore proceeding to create the sign-up form, the following dependencies must be succesfully installed on your system.Check and install express by using the ... Read More

Difference between NodeJS and ReactJS

Mayank Agarwal

Mayank Agarwal

Updated on 29-Apr-2021 09:19:07

361 Views

ReactJS and NodeJS both are a widely used subsets of JavaScript nowadays with high performance. But both are different in someways. In the below article, we will discuss the difference between the two and which is better to use to build a web application and why ?NodeJSIt is a completely ... Read More

writeJson() function in fs-extra - NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 07:36:01

1K+ Views

writeJson() writes an object to a JSON file by parsing.SyntaxwriteJson(file, object[, options] [, callback])Parametersfile – String parameter which will contain name and location of the JSON file.object – Object passed into the writeJson function.options – The 'outputFile' function supports the following options −spaces – The number of spaces will be passed in this parameter ... Read More

URLSearchParams values & keys() in Node

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 07:31:36

367 Views

Introduction to values()This function returns an iterator that allows us to iterate all over the values that are present in that object. It basically gives us a tool to select or iterate the values and then perform functions on them.SyntaxURLSearchParams.values();It will return an ES6 type iterator with the name-value pair ... Read More

URLSearchParams sort & toString() in Node

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 07:25:04

138 Views

Introduction to sort()This function sorts the existing name-value pairs by their names. The sorting is done inplace. It used stable algorithm for sorting.SyntaxURLSearchParams.sort(name);It will return a sorted order of elements (name-value pairs) by sorting them based on their key value.Example// Defining the parameters as a constant const params = new ... Read More

URLSearchParams.set & append() in Node

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 07:16:38

609 Views

Introduction to set()This function can be used to set the value of the name argument passed with the new value passed. If multiple name-value pair exists, only one name-value pair will be set and all the remaining pairs will be removed as shown in the example below.SyntaxURLSearchParams.set(name, value);ParametersThe inputs are ... Read More

URLSearchParams.has & delete() in Node

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 07:13:08

192 Views

Introduction to has()This function returns true or false based upon the query argument. The function will return true if name-value pair exists for the argument.Syntaxvar bool = URLSearchParams.has(name);It will return TRUE if name is present, else FALSE.ParametersThe input parameter is a name that needs to be searched in the URL.Example // ... Read More

Advertisements